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

Tres Seaver tseaver at palladion.com
Wed Jan 6 23:21:05 CET 2010

Hash: SHA1

John Gabriele wrote:
> On Tue, Jan 5, 2010 at 10:44 PM, David Lyon <david.lyon at preisshare.net> wrote:
>> Hi John,
>>> What is expected to be the standard way to do this in the near future?
>> PEP-345 says:
>>  > Requires-Dist: pywin32 (>1.0); sys.platform == 'win32'
>>  > Obsoletes-Dist: pywin31; sys.platform == 'win32'
>>  > Requires-Dist: foo (1,!=1.3); os.machine == 'i386'
>>  > Requires-Dist: bar; python_version == '2.4' or python_version == '2.5'
>>  > Requires-External: libxslt; 'linux' in sys.platform
>> To me that's really confusing.
> 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).
> 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?

Out of scope for the PEP, which only specifies the format of the
PKG-INFO file.  Once the pep is accepted, distutils will add arguments
to setup() to allow setting the new fields.

> 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?

Currently, use setuptools, and pass your dependencies to setup() via

  from setuptools import setup


Eventually (Python 2.7 or later, we hope), you will be able to pass
similar keyword arguments directly to the distutils, or (even better)
spell them in some declarative file which the distutils reads.

- --
Tres Seaver          +1 540-429-0999          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


More information about the Distutils-SIG mailing list