[Distutils] Python module for use in ‘setup.py’ but not to install
erik.m.bray at gmail.com
Mon Feb 2 23:19:10 CET 2015
On Sat, Jan 31, 2015 at 3:19 PM, Ethan Furman <ethan at stoneleaf.us> wrote:
> On 01/29/2015 08:58 PM, Ben Finney wrote:
>> Ethan Furman writes:
>>> However, I feel that requiring a dependency simply for the
>>> installation of the main package (the main package doesn't actually
>>> use this install-dependency, correct?) is heavy-handed and should be
>> It is ideally a build-time dependency and not an install-time
>> dependency, but I'm having a difficult time figuring out how to
>> distinguish those so Setuptools will pay attention.
> Ah, so it's needed with the sdist command and not the install command? Yeah, you definitely have my sympathies with
> that one. Too bad there's no easy way to specify behavior based on the command used... (hopefully someone will now tell
> how I am wrong about that ;) .
We just subclass the command in question to do the relevant tasks
(like generate some source files when running sdist). The subclassed
command can just try to import the dependencies
and raise a (useful) exception message if they are not available. For
example Astropy recently grew Jinja2 is a dependency to build some
source files. The built files are included in the sdist so casual
users don't have to worry about it.
Developers on the other hand will be nagged that they need Jinja2, and
it isn't automatically installed, which sucks. But for the most part
the only people who will need to worry about that can figure out how
to install build dependencies. I'm less worried about it for them
than I am for the casual user trying to run `python setup.py install`
(or pip install for that matter).
More information about the Distutils-SIG