I noticed what seems to be an inconsistent normalisation when running the following:
$ pipx run --python python3.12 -- pip-run 'packaging==24.1'
# Python 3.12.7 (main, Oct 1 2024, 08:52:11) [GCC 9.4.0] on linux
# Type "help", "copyright", "credits" or "license" for more information.
>>> from packaging.requirements import Requirement
>>> req1 = Requirement('mariadb>=1.0.1; extra == "mariadb_connector"')
>>> str(req1)
'mariadb>=1.0.1; extra == "mariadb-connector"'
>>> req2 = Requirement('mariadb>=1.0.1; python_version >= "3" and extra == "mariadb_connector"')
>>> str(req2)
'mariadb>=1.0.1; python_version >= "3" and extra == "mariadb_connector"'
Here for req1, Requirement.__str__ normalises the extra to mariadb-connector, in accordance to PEP 685.
But when there are other markers involved like in req2, it seems to preserve the original value without normalisation.
Is this behaviour expected? It looks a bit inconsistent to me.
Related to #644 (comment).
I noticed what seems to be an inconsistent normalisation when running the following:
Here for
req1,Requirement.__str__normalises the extra tomariadb-connector, in accordance to PEP 685.But when there are other markers involved like in
req2, it seems to preserve the original value without normalisation.Is this behaviour expected? It looks a bit inconsistent to me.
Related to #644 (comment).