[Distutils] setup_requires for dev environments
Tim Smith
tim at tim-smith.us
Thu Mar 19 17:45:23 CET 2015
On Thu, Mar 19, 2015 at 7:12 AM, Daniel Holth <dholth at gmail.com> wrote:
> So I'd like to suggest the following series of small improvements to both
> pip and setuptools:
>
> * setuptools: `python setup.py setup_requires` dumps its setup_requires
> keyword in 'requirements.txt' format
>
> It's is already in this format, so should be trivial, but allows one to do
> something like:
>
> $ python setup.py setup_requires > setup_requires.txt
> $ pip install -r setup_requires.txt
>
> Or in one bash line:
>
> $ pip install -r <( python setup.py setup_requires )
>
A way of learning about setup_requires dependencies would be helpful for
homebrew-pypi-poet [1], which helps generate Homebrew formulae for
applications implemented in Python. Homebrew prefers to specify all
dependencies explicitly in the formula rather than allowing easy_install or
pip to perform dependency resolution at formula install time. [2] We use
installed metadata to learn about install_requires dependencies but
setup_requires dependencies aren't captured AFAIK (are they?) so formula
authors have to identify those by hand. This isn't critically painful for
me but I thought it was an interesting example use case.
Tim
[1] https://github.com/tdsmith/homebrew-pypi-poet
[2] As Chris Barker notes, --single-version-externally-managed is a good
way to get setuptools-based setup.py's to just install the package;
--single-version-externally-managed hands the install process over to
distutils. Of course, distutils setup.py's do not support the
--single-version-externally-managed option. To have a consistent CLI
interface, Homebrew borrows a shim from pip's source to make sure we always
call setuptools.setup() when we run setup.py so that we can hand the
install back to distutils:
https://github.com/Homebrew/homebrew/blob/master/Library/Homebrew/language/python.rb#L78-L94
-- thanks to Donald for pointing to the right place in the pip code.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20150319/c07fb5ac/attachment.html>
More information about the Distutils-SIG
mailing list