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 1473924 commit 8ec8739
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
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

0 comments on commit 8ec8739

Please sign in to comment.