[Distutils] Q about best practices now (or near future)

Nick Coghlan ncoghlan at gmail.com
Sun Jul 21 04:54:47 CEST 2013

On 21 July 2013 11:53, PJ Eby <pje at telecommunity.com> wrote:
> On Sat, Jul 20, 2013 at 8:08 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
>> I see it as more useful for making an executable optional by defining a
>> "cli" extra. If your project just gets installed as a dependency, no wrapper
>> would get generated.
>> Only if you went "pip install myproject[cli]" (or another project
>> specifically depended on the cli extra) would it be installed.
> Why stop there...  how about environment markers for exports, too?
> ;-)  And throw in an environment marker syntax for whether something
> was installed as a dependency or explicitly...  ;-)

I actually did think about various ideas along those lines (when
pondering how build dependencies would work in practice), but realised
that install time checks for that kind of thing would be problematic
(since the dependencies for an extra might be present anyway, so why
require that you explicitly request the extra *as well*?).

> (Btw, the above is a change from setuptools semantics, but I don't
> really see it as a problem; ISTM unlikely that anybody has used extras
> on a script wrapper.  Extras on *other* entry points, however, *do*
> exist, at least IIRC.  I'm pretty sure there was at least one concrete
> use case for them involving Chandler plugins when I originally
> implemented the feature.  The possibility of having extras on a script
> is just a side effect, though, not an actually-intended feature; if
> you have the need, it actually makes more sense to just bundle the
> script in another package and require that pacakge from the extra,
> rather than putting it in the original package.)

Ah, interesting! And thinking about it further, I believe any kind of
"partial installation" of the *package itself* is a bad idea. Extras
should just be a way to ask "are these optional dependencies present
on this system?", without needing to worry about how they got there.

For now, I'll switch export specifiers back to the concise
"modulename:qualname" entry point format and add "Do we need to
support the exported-only-if-extra-is-available feature?" as an open
question. My current thinking is that the point you made about script
wrappers (putting the wrapper in separate distribution and depending
on that from an extra) applies to other plugins as well.


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Distutils-SIG mailing list