Skip to content

Commit 63a4f85

Browse files
committed
Show more info from pkg_resources deprecation (#3920)
2 parents 4a7c9c1 + 98537a9 commit 63a4f85

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

changelog.d/3920.misc.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Add a link to deprecation warning in ``pkg_resources`` and improve
2+
``stacklevel`` for better visibility.

pkg_resources/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@
118118
_namespace_packages = None
119119

120120

121-
warnings.warn("pkg_resources is deprecated as an API", DeprecationWarning)
121+
warnings.warn("pkg_resources is deprecated as an API. "
122+
"See https://setuptools.pypa.io/en/latest/pkg_resources.html",
123+
DeprecationWarning, stacklevel=2)
122124

123125

124126
_PEP440_FALLBACK = re.compile(r"^v?(?P<safe>(?:[0-9]+!)?[0-9]+(?:\.[0-9]+)*)", re.I)
@@ -1659,10 +1661,9 @@ def _validate_resource_path(path):
16591661

16601662
# for compatibility, warn; in future
16611663
# raise ValueError(msg)
1662-
warnings.warn(
1664+
issue_warning(
16631665
msg[:-1] + " and will raise exceptions in a future release.",
16641666
DeprecationWarning,
1665-
stacklevel=4,
16661667
)
16671668

16681669
def _get(self, path):

0 commit comments

Comments
 (0)