Skip to content

Commit 84b1cd8

Browse files
committed
Raise a deprecation warning when an invalid version is encountered. Ref #2497. Ref #2822.
1 parent 96475e3 commit 84b1cd8

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

changelog.d/2497.change.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Officially deprecated PEP 440 non-compliant versions.

pkg_resources/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ def parse_version(v):
113113
try:
114114
return packaging.version.Version(v)
115115
except packaging.version.InvalidVersion:
116+
warnings.warn(
117+
f"{v} is an invalid version and will not be supported in "
118+
"a future release",
119+
PkgResourcesDeprecationWarning,
120+
)
116121
return packaging.version.LegacyVersion(v)
117122

118123

pytest.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,6 @@ filterwarnings=
3131
# https://github.com/pypa/setuptools/issues/917
3232
ignore:setup.py install is deprecated.
3333
ignore:easy_install command is deprecated.
34+
35+
# https://github.com/pypa/setuptools/issues/2497
36+
ignore:.* is an invalid version and will not be supported::pkg_resources

0 commit comments

Comments
 (0)