[Distutils] Environment markers: ready for prime time?

Robert Collins robertc at robertcollins.net
Wed Oct 28 20:57:37 EDT 2015


On 29 October 2015 at 06:08, Marius Gedminas <marius at gedmin.as> wrote:
> Hi!
>
> pip 7 enables wheel caching by default, which is good.
>
> Wheel caching means you can't compute dynamic dependencies any more --
> i.e. things like
>
>   setup(
>     ...
>     install_requires=[...] + (['enum34'] if sys.version_info[0] < 3 else []),
>     ...)
>
> will cause problems.
>
> As far as I understand, you're supposed to use environment markers
> instead.
>
>
> Problem 1: where's the documentation?  E.g.
> https://python-packaging-user-guide.readthedocs.org/en/latest/distributing/
> has no mention of the word "marker".
>
> Try to google "setuptools environment marker" (and how is a user going
> to discover the magical keyword they need to google is "environment
> marker")?  Try to find anything resembling documentation on the 1st
> page.  The best I could find was
> http://docs.openstack.org/developer/pbr/#environment-markers which only
> works if you use pbr.
>
> Even the spec (https://www.python.org/dev/peps/pep-0426/#environment-markers)
> only shows how the markers are supposed to appear in the JSON metadata.
> No clue is provided for poor writers of setup.py files.
>
> I somehow discovered the syntax once (I don't remember how -- most
> likely kind people in #pypa spoon-fed me), but now I'm cargo-culting my
> existing setup.py files that already use environment markers.
>
>
> Problem 2: what are the minimum versions of the tools that your users
> must have before you can rely on environment markers?
>
> - setuptools >= 0.7 ("Added experimental environment marker support")
>
> - wheel >= 0.24 (if you have wheel 0.23 or older, environment markers are
>   silently broken and have fun figuring out why:
>   https://github.com/pypa/pip/issues/2870).
>
> - does the pip version matter at all?  I think not; please correct me if
>   I'm wrong.
>
>
> Some official answers from the hard-working PyPA visionaries would be welcome.

Not an official, but ...

https://github.com/pypa/pip/issues/3111
https://bugs.launchpad.net/pbr/+bug/1502692

may give some useful info for you.

Don't forget that markers are broken vis-a-vis Python 2.7.10, which we
need to fix asap.

-Rob

-- 
Robert Collins <rbtcollins at hp.com>
Distinguished Technologist
HP Converged Cloud


More information about the Distutils-SIG mailing list