[Distutils] PEP 426: proposed metadata caching convention

Daniel Holth dholth at gmail.com
Mon Feb 25 15:46:48 CET 2013

On Mon, Feb 25, 2013 at 9:39 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:

> (This probably belongs in a successor to PEP 376, but I'll leave it
> under the PEP 426 umbrella for now)
> One of the points raised regarding PEP 426's integrated metadata
> format is the potential for runtime issues with pkg_resources as it
> reads and processes the metadata during startup, particularly if it
> needs to process any environment markers. While I acknowledge the
> suggestions I have received that we should really be moving away from
> the current filesystem based distributed installation information to a
> real database that properly handle import hooks, I'm looking for
> something simpler that will make it easier for setuptools and
> distribute to consume the new metadata format (and thus hopefully make
> them more amenable to generating it as well)
> Assuming we add an Entry-Points field as I have proposed in another
> message, I'd like to propose that installers generate three additional
> cache files as part of the installation process:
>     <dist-info-dir>/__cache__/version.txt
>     <dist-info-dir>/__cache__/requires-dist.txt
>     <dist-info-dir>/__cache__/entry-points.txt
> version.txt would just be the version of the installed distribution
> (no need to parse the main metadata file just to read the version
> field)
> requires-dist.txt would be similar to the pkg_resources requires.txt
> format, but use PEP 426 version specifiers. It would:
> - only contain runtime requirements where the environment markers
> match the current system
> - be split into sections based on the "extras" definition needed to
> get the environment marker to pass
> entry-points.txt would be the same format as the pkg_resources
> entry_points.txt
> Cheers,
> Nick.

I like the idea of making the installer a little smarter for backwards
compat. reasons. Wouldn't the specific cached files generated be the sole
domain of a post-install hook provided by pkg_resources?

The version is not parsed from METADATA when it can be read from the
.dist-info directory's filename (true when it is not in development). When
it is read, METADATA is only parsed until the line that starts with Version:

It would be a win to evaluate the environment markers at install time. For
my web applications that evaluate many .dist-info directories runtime
parsing is good enough for me, but startup time pressure is higher for
console scripts.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20130225/281a61fd/attachment.html>

More information about the Distutils-SIG mailing list