Skip to content

Accept all PEP 508 operators in python_version markers - #5310

Open
Daksha1611 wants to merge 1 commit into
aboutcode-org:developfrom
Daksha1611:fix-pypi-python-version-markers
Open

Accept all PEP 508 operators in python_version markers#5310
Daksha1611 wants to merge 1 commit into
aboutcode-org:developfrom
Daksha1611:fix-pypi-python-version-markers

Conversation

@Daksha1611

@Daksha1611 Daksha1611 commented Sep 11, 2026

Copy link
Copy Markdown

Fixes #5309

The operator list in get_python_version_os() has < twice and no >:

python_version_operators = ['<', '>=', '==', '<=', '<']

So requests; python_version > "3.8" never matched and the marker was dropped from the dependency extra_data, while >= on the same requirement was picked up fine. != and ~= were missing for the same reason.

Replaced that list with the comparison operators PEP 508 allows in a marker, and added a test covering each of them. sys_platform and the no-marker path are untouched.

…5309

The list of operators accepted by get_python_version_os() contained '<'
twice and was missing '>', so a dependency marker such as
"python_version > '3.8'" never matched and was silently dropped from the
DependentPackage extra_data, while ">=" was reported correctly. The '!='
and '~=' operators were missing for the same reason.

Replace the duplicated '<' with the full set of comparison operators
allowed for a marker in PEP 508, and add a regression test covering each
of them.

Signed-off-by: Daksha1611 <mehtadaksha1611@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

python_version markers using >, != or ~= are silently dropped from dependency extra_data

1 participant