Sunday, 27 June 2021

How to specify platforms-specific extras or version in Pipfile?

The "Advanced Usage of Pipenv" docs, in the "Specifying Basically Anything" section, explains how to include a package requirement, conditionally on the os platform, in the Pipfile, eg:

pywinusb = {version = "*", sys_platform = "== 'win32'"}

It's not clear what to do when one wants to specify different version or options for a package, depending on the platform.

Specifically, I have this requirement:

faust = {version=">=1.10.1", extras=["aiodns", "ciso8601", "cython"]}

and I want to exclude the optional extra ciso8601 in Windows.

If I write

faust = {version=">=1.10.1", extras=["aiodns", "ciso8601", "cython"], platform_system = "!= 'Windows'"}
faust = {version=">=1.10.1", extras=["aiodns", "cython"], platform_system = "== 'Windows'"}

I get the error: tomlkit.exceptions.KeyAlreadyPresent: Key "faust " already exists.

Additionally, I want the same thing in the setup.py (install_requires section).



from How to specify platforms-specific extras or version in Pipfile?

No comments:

Post a Comment