[Distutils] current preferred way to specify dependencies? future?

Carl Meyer carl at dirtcircle.com
Wed Jan 6 17:07:30 CET 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi John,

Isn't distutils-sig fun? Ask a simple question, get a recycled rant that
doesn't answer your question... ;-)

John Gabriele wrote:
[snip]
> I'm a bit confused myself... PEP-345 says it "describes a mechanism
> for adding metadata to Python packages", but I think they really mean
> "distributions" (the things available at the PyPI).

IMO you're right, that word ought to be "distributions", though those
terms often aren't used with as clear a distinction as I'd prefer.

> Also, it looks like pep345 describes what fields can go into a
> PKG-INFO file, but not how you get them in there. AFAIK, I'm not
> supposed to write my own PKG-INFO file -- setup.py does it for me.
> What I'm really asking about here is, what args go in the `setup()`
> call in the `setup.py` file?

I'm not aware that the corresponding setup() args are documented in a
PEP anywhere (hopefully someone will correct me if I'm wrong). Perhaps
they should be. Following the principle of least surprise I would assume
they would be requires_dist, provides_dist, etc, and would take lists of
strings, in the same format as in the PEP (name followed by version spec
in parenths).

The PEP 345 options are named with -Dist suffix precisely because they
name distributions. PEP 314 (which 345 obsoletes) had "Requires",
"Provides" etc, but they named packages/modules. Those never got much
use and are now considered a mistake, which is why they are being
replaced with the *-Dist markers.

> If my FooBar-0.1.0 distribution depends upon packages and modules in
> CoolStuff-2.0.0 and ReallyNeatStuff-1.5.5, what's the current best way
> to say so, and what's going to be the standard going forward?

The current most-often-used way to say so is to the setuptools-specific
argument install_requires=['CoolStuff==2.0.0', 'ReallyNeatStuff==1.5.5']
(though that's being perhaps a bit more precise with the version
specifiers than you'd really want to be). Obviously that's only
supported if you use setuptools. The standard going forward will
hopefully be PEP 345.

Carl
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFLRLVC1j/fhc23WEARAqDsAJ42S+o2kLs21MzJnOYZoRyhpXiA2ACgoAZ/
RgXdl62mgqY8piaDBYK6q8U=
=fpZc
-----END PGP SIGNATURE-----


More information about the Distutils-SIG mailing list