Correct use of PEP 508 environment markers in setup.cfg

Viewed 1699

I am trying to make use of PEP 496 -- Environment Markers and PEP 508 -- Dependency specification for Python Software Packages by specifying dependencies that only make sense on specific OS.

My setup.py looks like this:

import setuptools
assert setuptools.__version__ >= '36.0'

setuptools.setup()

My minimal setup.cfg looks like this:

[metadata]
name = foobar
version = 1.6.5+0.1.0

[options]
packages = find:

install_requires =
    ham >= 0.1.0
    eggs >= 8.1.2
    spam >= 1.2.3; platform_system=="Darwin"
    i-love-spam >= 1.2.0; platform_system="Darwin"

However, when trying to install such a package with pip install -e foobar/, it fails with:

pip._vendor.pkg_resources.RequirementParseError: Invalid requirement, parse error at "'; platfo'"

I guess it does not expect semicolon there. But how am I supposed to use environment markers then?

1 Answers
Related