Skip to content

Commit 0a4eec2

Browse files
authored
Merge branch 'main' into fix-prerelease-detection-for->-and-<
2 parents a0e7b90 + 24e5350 commit 0a4eec2

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

docs/utils.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,12 @@ Reference
5656
>>> is_normalized_name("Django")
5757
False
5858

59-
.. function:: canonicalize_version(version)
59+
.. function:: canonicalize_version(version, strip_trailing_zero=True)
6060

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

6566
:param str version: The version to normalize.
6667

src/packaging/metadata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ class RawMetadata(TypedDict, total=False):
167167

168168

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

173173

src/packaging/version.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,8 @@ def public(self) -> str:
350350
'1.2.3'
351351
>>> Version("1.2.3+abc").public
352352
'1.2.3'
353-
>>> Version("1.2.3+abc.dev1").public
354-
'1.2.3'
353+
>>> Version("1!1.2.3dev1+abc").public
354+
'1!1.2.3.dev1'
355355
"""
356356
return str(self).split("+", 1)[0]
357357

@@ -363,7 +363,7 @@ def base_version(self) -> str:
363363
'1.2.3'
364364
>>> Version("1.2.3+abc").base_version
365365
'1.2.3'
366-
>>> Version("1!1.2.3+abc.dev1").base_version
366+
>>> Version("1!1.2.3dev1+abc").base_version
367367
'1!1.2.3'
368368
369369
The "base version" is the public version of the project without any pre or post

0 commit comments

Comments
 (0)