I am using pyproject.toml
according to PEP 631 (i.e. NO poetry
, I am using pdm
). I need to specify a dependency version according to the operating system.
So far, I tried something like this:
[project]
...
dependencies = [
"kaleido==0.0.3; platform_system!='Windows'",
"kaleido==0.1.0post1; platform_system=='Windows'",
]
What I want to achieve is that kaleido
will be installed in version 0.0.3 if the operating system is NOT Windows. On the other hand, if Windows is used, then I want kaleido
to be installed in version 0.1.0post1
.
What I learned is that the first row will always be ignored, that is, if I am installing the package on a linux machine, kaleido v0.0.3
won't be installed. On a Windows machine kaleido v0.1.0post1
will successfully be installed.
If I switch the two code lines, the behaviour will be the opposite, i.e. kaleido v0.0.3
will be installed on the linux machine while no kaleido
will be installed on a Windows machine.
The actual question is, what is the correct syntax in the pyproject.toml
to work on all operating systems?