[Distutils] setup.cfg new format proposal

P.J. Eby pje at telecommunity.com
Thu Sep 17 05:34:07 CEST 2009


At 10:13 PM 9/16/2009 -0400, David Lyon wrote:
>On Wed, 16 Sep 2009 22:01:20 -0400, "P.J. Eby" <pje at telecommunity.com>
>wrote:
> > It's not the application's business what the installation directory
> > is;
>
>Yes, but it very much is.
>
>An application needs to know what directory it has been installed
>in and where it can find configuration files and so forth.

It appears I was unclear: it is not the application's business to 
*decide* what the installation directory is.


> > nor is it something that should be specified in setup.py or
> > setup.cfg, as that is 100% the user's business to choose, and the
> > platform tools to supply a default for.
>
>Well, it certainly doesn't work that way at the moment.

Eh?  It's *possible* to specify it in those places now, but 
well-behaved packages never do.


> > I suspect there is some confusion here; I'm precisely suggesting that
> > we not invent a new, general wheel if we can address the real use
> > cases with a slight adjustment to something we already have (e.g. the
> > extras syntax).
>
>Yes, there's much confusion. That's the problem, in addition to many
>annoying limitations and shortcomings.
>
>So if you want to go ahead and describe what needs to be done in\
>nice simple easy to understand terms it would benefit everyone.

If platform/pyver-specific dependencies are all that's required, 
there's a way to specify them using setuptools' existing dependency 
syntax, using "extras".   install_requires is allowed to have 
sections that express additional requirements (aka "extras") that can 
optionally be installed along with the base package.  Each "extra" 
links an option name (e.g. "pdf-support") to one or more additional 
dependencies (e.g. "reportlab>1.2").

In current versions of setuptools-based installers (such as pip, 
easy_install, buildout, etc.), these extras must be explicitly 
specified in a requirement, in order to install them.  For example, 
"easy_install foo[pdf-support,png-support]" to install foo along with 
whatever requirements are needed for PDF and PNG support.  However, 
if a syntax for extra names were devised, one could implicitly 
specify extras like 'python-lt-2.6' to be automatically installed 
when the conditions are met.

In other words, there's already a framework for actually 
*implementing* conditional dependencies, it just needs to have a 
convention for naming of "extras" to allow it to work.  And in the 
absence of tool support, it could even be implemented manually, by 
adding the necessary extra names on the command line of existing 
installation tools.



More information about the Distutils-SIG mailing list