[Distutils] PEP 426: proposed metadata caching convention

Daniel Holth dholth at gmail.com
Thu Feb 28 16:27:43 CET 2013


On Thu, Feb 28, 2013 at 10:04 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On Fri, Mar 1, 2013 at 12:00 AM, Daniel Holth <dholth at gmail.com> wrote:
>> We will probably wind up with some JSON very much like that. I like
>> just exposing it as an ordered multidict with the same key names as
>> mentioned in the PEP.
>
> A multidict is not really JSON-compatible - making sure there's an
> unambiguous mapping to an ordinary dictionary is highly desirable.
> Also, it's handy to pre-split and group the entries conditioned on the
> environment markers.

Sure, nothing wrong with it. Just don't bother pluralizing the names.
"Goose: gander" becomes "geese" : {} no thanks.

>> IMO the environment marker for "always" is just
>> "" (empty string).
>
> I initially had that, but it looked weird in the case where there
> weren't any conditional entries, and it also looks weird when
> accessing the data structure. By contrast, "always" is a
> self-describing key.

Or True, or an environment-marker tautology...

>> My hook would be a literal Entry-Point. You would install a package
>> "twisted.plugins" that would register its interest in installation
>> changes by declaring the entry point "[packaging.hooks]
>> post_install=twisted.plugins:hook". Afterwards, every time you install
>> or uninstall another package, twisted.plugins.hook() would be called.
>> It would iterate over all installed distributions using some API like
>> pkg_resources.working_set or distlib's database and do whatever it
>> needed to do. It could be called once per pip invocation instead of
>> once per individual package.
>>
>> The hook is not guaranteed to run. If you do not run the hook, you
>> should expect Twisted's plugin discovery process to take longer just
>> like it does today. In fact the packages available on sys.path are not
>> guaranteed to "have been installed" at all.
>
> This is *not* the same kind of hook at all. The proposed hook is only

That is why this conversation has been so confusing :-)

> run when *Twisted* is installed to replace some current legitimate
> customisation of "./setup.py install" behaviour, not when an arbitrary
> package is installed to let Twisted know about it. Your suggestion
> would indeed be more appropriately part of an installer-specific entry
> point (but one made much easier by the standard including an algorithm
> for conversion to structured metadata).


More information about the Distutils-SIG mailing list