Skip to content

Commit

Permalink
Fixes pypa#920. Don't replace unserscores with hyphens in distributio…
Browse files Browse the repository at this point in the history
…n name.
  • Loading branch information
navrkald committed Aug 16, 2022
1 parent 8f5e5d6 commit 9804370
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions tests/test_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ def test_package_signed_name_is_correct():
(string.digits, string.digits),
(string.punctuation, "-.-"),
("mosaik.SimConfig", "mosaik.SimConfig"),
("package_name", "package_name"),
("mosaik$$$$.SimConfig", "mosaik-.SimConfig"),
],
)
Expand Down
4 changes: 2 additions & 2 deletions twine/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@
def _safe_name(name: str) -> str:
"""Convert an arbitrary string to a standard distribution name.
Any runs of non-alphanumeric/. characters are replaced with a single '-'.
Any runs of non-alphanumeric/./_ characters are replaced with a single '-'.
Copied from pkg_resources.safe_name for compatibility with warehouse.
See https://github.com/pypa/twine/issues/743.
"""
return re.sub("[^A-Za-z0-9.]+", "-", name)
return re.sub("[^A-Za-z0-9._]+", "-", name)


class PackageFile:
Expand Down

0 comments on commit 9804370

Please sign in to comment.