@@ -659,7 +659,7 @@ def _version_compatible(left, right):
659659 # Note, the ~= operator can be also expressed as:
660660 # >= V.N, == V.*
661661 head , _ , _ = right .norm .partition ("." )
662- right_star = parse_version ("{}.*" .format (head ))
662+ right_star = version ("{}.*" .format (head ))
663663 return left .ge (right ) and left .eq (right_star )
664664
665665def _first_non_none (* args ):
@@ -764,23 +764,21 @@ def _new_version(*, epoch = 0, release, pre = "", post = "", dev = "", local = "
764764
765765 return self
766766
767- def parse_version ( version , strict = False ):
767+ def version ( version_str , strict = False ):
768768 """Parse a PEP4408 compliant version
769769
770- TODO @aignas 2025-05-06: where should this go?
771-
772770 See https://packaging.python.org/en/latest/specifications/binary-distribution-format/#escaping-and-unicode
773771 and https://peps.python.org/pep-0440/
774772
775773 Args:
776- version : version string to be normalized according to PEP 440.
774+ version_str : version string to be normalized according to PEP 440.
777775 strict: fail if the version is invalid.
778776
779777 Returns:
780778 string containing the normalized version.
781779 """
782780
783- parser = _new (version .strip (" " if strict else " .*" )) # PEP 440: Leading and Trailing Whitespace and .*
781+ parser = _new (version_str .strip (" " if strict else " .*" )) # PEP 440: Leading and Trailing Whitespace and .*
784782
785783 accept (parser , _is ("v" ), "" ) # PEP 440: Preceding v character
786784
@@ -799,7 +797,7 @@ def parse_version(version, strict = False):
799797 parts [p ] = parser .context ()["norm" ]
800798 parser .context ()["norm" ] = "" # Clear out the buffer so that it is easy to separate the fields
801799
802- is_prefix = version .endswith (".*" )
800+ is_prefix = version_str .endswith (".*" )
803801 parts ["is_prefix" ] = is_prefix
804802 if is_prefix and (parts ["local" ] or parts ["post" ] or parts ["dev" ] or parts ["pre" ]):
805803 if strict :
0 commit comments