The subprocess is certainly more compatible. And pip does not really have
an API besides the command line interface. But a lot of packages could
probably work with "import pip". (Setup.py is already running in a pip
subprocess when invoked by pip.) If you were pressed for time then you
should be using wheel. 😺🎡
Might be interesting to add a bit more affordance for installers that want
to implement setup requires themselves and skip the bootstrapper.
On May 29, 2014 11:55 AM, "Erik Bray"
On Mon, May 19, 2014 at 9:24 PM, Daniel Holth
wrote: Here's a short setup.py replacement that makes setup-requires work: https://bitbucket.org/dholth/setup-requires/src/ . I'd appreciate a code review.
Use by renaming your own package's setup.py to real-setup.py and copying this setup.py in its place.
List only the requirements setup.py itself needs to run in the `setup-requires =` key of the `[metadata]` section of setup.cfg, one per line::
[metadata] setup-requires = cffi pip pycparser >= 2.10
(Only the name and required versions are allowed, not the full pip syntax of URLs to specific repositories. Instead, install internal setup-requires dependencies manually or set PIP_FIND_LINKS=... to point to the necessary repositories.)
When run, setup-requires' setup.py checks that each distribution listed in setup-requires is installed; if not, it installs them into the ./setup-requires directory in a pip subprocess. Then real-setup.py continues to execute with the same arguments.
Why a custom section in setup.cfg? Users are accustomed to editing setup.cfg to configure random things like unit tests, bdist_wheel etc.; this just adds a field instead of a new file. Unlike a .txt file it should be more intuitive that setup.cfg does not support the full pip requirements syntax.
Please note that not every package installs correctly with pip -t.
Now let's see some setup.py helper packages.
Thanks, I like the approach this takes of using pip instead of easy-install, and caching all the setup_requires packages in the setup-requires directory without cluttering the source root with eggs. I'm not crazy about having to launch a separate process to do this--do you think it can be done without that, by just importing pip and using its API? Or did you find that to be too problematic?
I'm also not crazy about putting the real setup.py in a separate file, but only because, in my case, I think it's likely to confuse some of my co-developers. That said, I think that this approach could be adapted to suit my needs.
Erik _______________________________________________ Distutils-SIG maillist - Distutils-SIG@python.org https://mail.python.org/mailman/listinfo/distutils-sig