[Distutils] How to implement ‘setup.py’ functionality that itself needs third-party distributions

Ben Finney ben+python at benfinney.id.au
Wed Jan 21 04:27:52 CET 2015

Carl Meyer <carl at oddbird.net> writes:

> On 01/20/2015 07:28 PM, Ben Finney wrote:
> > What I need is a way to express “ensure Docutils is installed before
> > continuing with other Setuptools actions” in ‘setup.py’. I don't
> > know of a neat way to tell Setuptools that.
> That is the precise purpose of the `setup_requires` kwarg.

That's too late though. What I need is to be able to instruct the build
process to install Docutils so I can get stuff done *before ‘setup()’ is

Is there an API within Distutils or Setuptools that allows me to say “I
haven't declared anything yet but go get and install distribution FOO
right now”? I could do that before importing the module which needs

 \           “The long-term solution to mountains of waste is not more |
  `\      landfill sites but fewer shopping centres.” —Clive Hamilton, |
_o__)                                                _Affluenza_, 2005 |
Ben Finney

More information about the Distutils-SIG mailing list