fluter
fluter

Reputation: 13796

Version condition in python_requires

We have a package that works on 2.7 and post 3.8 version, we need keep 2.7 as to provide support for users that have not moved, but when i do this in setup.py:

python_requires="== 2.7.*, >= 3.8"

this does not work, when i install the generated wheel file in 3.8.11, it says:

ERROR: Package 'mypkg' requires a different Python: 3.8.11 not in '==2.7.*,>=3.8'

why is 3.8.11 not >= 3.8? how can fix this?

Upvotes: 1

Views: 6421

Answers (1)

blhsing
blhsing

Reputation: 106553

This is because the comma , acts as a logical "and" operator in Python's version specifiers, and no single version can match both == 2.7.* and >= 3.8 at the same time.

Since unfortunately there is no "or" operator provided in the version specifiers, you would have to work around this by exhaustively excluding the known incompatible versions between the two compatible ranges instead:

python_requires=">= 2.7, != 3.0.*, != 3.1.*, != 3.2.*, != 3.3.*, != 3.4.*, != 3.5.*, != 3.6.*, != 3.7.*"

Upvotes: 1

Related Questions