[Distutils] Environment markers: ready for prime time?

Marius Gedminas marius at gedmin.as
Wed Oct 28 13:08:12 EDT 2015


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.

Marius Gedminas
-- 
I once held a little hand
That made my sad heart sing.
Twas the loveliest hand I'd ever held,
Four Aces and a King
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 173 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20151028/45040fa4/attachment.sig>


More information about the Distutils-SIG mailing list