Skip to content

Commit

Permalink
Merge branch 'main' into fix-prerelease-detection-for->-and-<
Browse files Browse the repository at this point in the history
  • Loading branch information
brettcannon committed Aug 8, 2024
2 parents a0e7b90 + 24e5350 commit 0a4eec2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions docs/utils.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,12 @@ Reference
>>> is_normalized_name("Django")
False

.. function:: canonicalize_version(version)
.. function:: canonicalize_version(version, strip_trailing_zero=True)

This function takes a string representing a package version (or a
:class:`~packaging.version.Version` instance), and returns the
normalized form of it.
normalized form of it. By default, it strips trailing zeros from
the release segment.

:param str version: The version to normalize.

Expand Down
2 changes: 1 addition & 1 deletion src/packaging/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class RawMetadata(TypedDict, total=False):


def _parse_keywords(data: str) -> list[str]:
"""Split a string of comma-separate keyboards into a list of keywords."""
"""Split a string of comma-separated keywords into a list of keywords."""
return [k.strip() for k in data.split(",")]


Expand Down
6 changes: 3 additions & 3 deletions src/packaging/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,8 @@ def public(self) -> str:
'1.2.3'
>>> Version("1.2.3+abc").public
'1.2.3'
>>> Version("1.2.3+abc.dev1").public
'1.2.3'
>>> Version("1!1.2.3dev1+abc").public
'1!1.2.3.dev1'
"""
return str(self).split("+", 1)[0]

Expand All @@ -363,7 +363,7 @@ def base_version(self) -> str:
'1.2.3'
>>> Version("1.2.3+abc").base_version
'1.2.3'
>>> Version("1!1.2.3+abc.dev1").base_version
>>> Version("1!1.2.3dev1+abc").base_version
'1!1.2.3'
The "base version" is the public version of the project without any pre or post
Expand Down

0 comments on commit 0a4eec2

Please sign in to comment.