Skip to content

Marker comparisons silently switches from version comparison to lexicographically  #633

@konstin

Description

@konstin

Marker comparisons silently switch from version number comparison to stringly, lexicographical comparison, e.g. on python 3.10 and packaging 22.0:

>>> from packaging.requirements import Requirement
>>> Requirement('numpy; python_version >= "3.9."').marker.evaluate()
False
>>> Requirement('numpy; python_version >= "3.9"').marker.evaluate()
True

I'm not aware of any case where that behavior is intended and PEP 508 is fuzzy about this, so i'd propose to print a warning whenever one of the version_cmp operators gets used without valid PEP 440 versions, and amend PEP 508 / Dependency specifiers with that.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions