[Distutils] distlib updated with "locators" API

Daniel Holth dholth at gmail.com
Mon Oct 15 19:32:05 CEST 2012


On Sat, Oct 13, 2012 at 8:16 PM, Vinay Sajip <vinay_sajip at yahoo.co.uk> wrote:
> There's plenty more work to do - if there's mileage in this idea, instead of
> returning Metadata and lists of dicts, Distribution instances can be returned
> which can be queried for dependencies in a more natural way. At the moment,
> this (dependency querying) isn't fully doable because all the metadata is not
> declarative. However, the work I've been doing with the package.yaml metadata
> format indicates that setup()-kwarg metadata can be automatically pulled out of
> setup.py for many (most) of the projects on PyPI.

When you are using setuptools, setup.py can be used to generate
declarative metadata with the command "python setup.py egg_info". You
can add --egg-base <dir> to put the static metadata in a different
directory. Setuptools even makes it easy to add new metadata files to
the .egg-info folder by using a plugin to write each file. The
majority of the sdists on pypi contain pre-built versions of this
static metadata in .egg-info folders.

Unfortunately setup.py is used to build not one, but many different
dists (the most common difference of course being different
requirements) depending on any number of factors, so pip rebuilds the
static metadata before using it. Metadata 1.2+ of course allow us to
put the most common "reasons for different dependencies" conditions in
the static metadata itself.

Wheel reads requires-dist lines from setup.cfg's [metadata] section so
you can actually include Metadata 1.2+ style conditional dependencies.
Unfortunately this feature makes it very easy to write sdists that
install different dependencies if they are installed from a wheel
archive versus straight from the sdist.


More information about the Distutils-SIG mailing list