[Distutils] setup_requires: the obvious option(?)

Antony Lee anntzer.lee at gmail.com
Tue Aug 30 12:51:14 EDT 2016

2016-08-30 5:08 GMT-07:00 Erik Bray <erik.m.bray at gmail.com>:

> I mean this sort of already exists but it's spelled:
> from setuptools import Distribution
> Distribution({'setup_requires': ['numpy'])
> Granted it's non-obvious and doesn't have the needed_for flag, which I
> like.  It's not entirely clear how needed_for would work though.  For
> example, what if the package you're requiring provides the command
> that you need that package to run?

needed_for just textually checks sys.argv[1], and does so before the call
to setup() itself happens, so that's not a problem.

The same can be done by subclassing commands, and there can be some
> corner cases where that gets extra tricky (Cython comes to mind).

I personally don't like subclassing commands at all (it's not very
composable -- what happens if two projects both attempt to subclass
build_ext?).  But even then, how is Cython an issue?

I'm glad you mentioned Daniel Holth's setup-requires hack.  Although I
> haven't used it myself directly I generally like the concept.

I am not really a fan of PEP518 in general.  Basically, the idea of
setup.py is that declarative languages are not sufficient to express a
build system (and AFAICT this is always going to be the case for
expressing, say, compiler flags for extensions), so I'd rather just accept
that and stick everything in setup.py instead of adding more parameter
files.  What if someone wants dynamic build dependencies?

> Yeah, setup_requires is a mess, but I'd be skeptical of solving the
> problem by depending on any new features in setuptools :/

This could also go into pip (perhaps a better solution now that pip is
de-facto stdlib (via ensurepip))... we'll need something new somewhere

> Best,
> Erik


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20160830/5e0dc333/attachment.html>

More information about the Distutils-SIG mailing list