Skip to content

Commit

Permalink
Raise a deprecation warning when an invalid version is encountered. Ref
Browse files Browse the repository at this point in the history
#2497. Ref #2822.
  • Loading branch information
jaraco committed Nov 1, 2021
1 parent 96475e3 commit 84b1cd8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/2497.change.rst
@@ -0,0 +1 @@
Officially deprecated PEP 440 non-compliant versions.
5 changes: 5 additions & 0 deletions pkg_resources/__init__.py
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
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

0 comments on commit 84b1cd8

Please sign in to comment.