Reputation: 5228
I have a requirements.txt file that specifies an optional dependency that fails when running on PYPY.
I know you can make lines in the requirements.txt file conditional on Python version, or operating system. For instance:
Following dependencies will only be installed for Python 3.5+ and on Win32 respectively
black;python_version > '3.5'
colorama;platform_system=="Windows"
However, I'm looking for a way to only install a package if the platform.python_implementation()
is CPython, or not PYPY.
Upvotes: 2
Views: 1987
Reputation: 5228
As I was writing this, I found the answer:
https://www.python.org/dev/peps/pep-0508/
The previous code can be augmented as follows:
black;python_version > '3.5' and platform_python_implementation=="CPython"
colorama;platform_system=="Windows"
Upvotes: 4