Skip to content

Deprecate LegacyVersion #2840

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/2497.change.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Officially deprecated PEP 440 non-compliant versions.
5 changes: 5 additions & 0 deletions pkg_resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ def parse_version(v):
try:
return packaging.version.Version(v)
except packaging.version.InvalidVersion:
warnings.warn(
f"{v} is an invalid version and will not be supported in "
"a future release",
PkgResourcesDeprecationWarning,
)
return packaging.version.LegacyVersion(v)


Expand Down
3 changes: 3 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ filterwarnings=
# https://github.com/pypa/setuptools/issues/917
ignore:setup.py install is deprecated.
ignore:easy_install command is deprecated.

# https://github.com/pypa/setuptools/issues/2497
ignore:.* is an invalid version and will not be supported::pkg_resources