[Distutils] PEP 365 (Adding the pkg_resources module)
zooko
zooko at zooko.com
Mon Mar 17 22:19:31 CET 2008
Folks:
(By the way, it was a pleasure to meet many of you in Real Life for
the first time at Pycon.)
Here is what I want:
1. The standard Python build tools by default produce machine-
parseable package metadata, which can include package dependency
information with reasonably well-defined semantics.
Oh good! I already have this, since distutils in Python >= 2.5
produces .egg-info metadata in an easy-to-parse format.
2. This machine-parseable metadata is widely supported and
understood by the Python community.
In retrospect, it's too bad that it isn't named ".pkg-info" instead
of ".egg-info", in order to avoid the fraught politics around the
concept of "eggs". A concrete example of such a misunderstanding is
the sad fact that many Linux distributions were in the habit of
deleting this information from their Python packages, perhaps because
they were under the impression that it was obviated by their
packaging tools. The major distributions have all stopped doing this
now.
Unifying the created-by-default PKG-INFO files and the created-by-
default .egg-info directories would be nice, too.
3. The standard Python library includes a tool to find and parse
this metadata, so that I can write programmatic tests of my
dependencies, like this:
http://allmydata.org/trac/tahoe/browser/_auto_deps.py?rev=2062
This is one of the improvements that I was anticipating from
pkg_resources going into the standard library.
4. The standard Python library includes a tool to find and read
resources (other than Python modules) that came bundled in a Python
package.
Consider, for example, this snippets of code in Nevow:
http://divmod.org/trac/browser/trunk/Nevow/setup.py?rev=13786#L10
http://divmod.org/trac/browser/trunk/Nevow/setup.py?rev=13786
http://divmod.org/trac/browser/trunk/Nevow/setup_egg.py?rev=2406
When Nevow uses pkg_resources to import its files such as
"default.css", then it is able to find at runtime, even if is being
imported from a py2exe or py2app zip, or on other platforms where its
homegrown setup script and homegrown "find my file" function fail.
So using pkg_resources (and setuptools to install it) makes
"test_nevow" pass on all of the allmydata.org buildslaves:
http://allmydata.org/buildbot/waterfall?show_events=false
Regards,
Zooko
More information about the Distutils-SIG
mailing list