I have a Python package that I would like to make into a wheel. On Python 2, the package uses the ipaddr
library. On Python 3, it uses the built-in ipaddress
library. For the sdist
package, I check the sys.version_info
in setup.py
to set the requirements based on the Python version. Unfortunately, this does not seem to work with wheels. Is it possible to do a conditional dependency based on the Python version with a wheel?
As of Wheel 0.24.0, this is support using extra_require
. For instance
setup(
...,
extras_require={':python_version=="2.6"':: ['ipaddr']},
...
)
This is documented in the "Defining Conditional Dependencies" of the Wheel documentation and follows PEP 426.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With