Skip to content

Commit

Permalink
Show more info from pkg_resources deprecation (#3920)
Browse files Browse the repository at this point in the history
  • Loading branch information
abravalheri committed Jun 19, 2023
2 parents 4a7c9c1 + 98537a9 commit 63a4f85
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions changelog.d/3920.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Add a link to deprecation warning in ``pkg_resources`` and improve
``stacklevel`` for better visibility.
7 changes: 4 additions & 3 deletions pkg_resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@
_namespace_packages = None


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


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

# for compatibility, warn; in future
# raise ValueError(msg)
warnings.warn(
issue_warning(
msg[:-1] + " and will raise exceptions in a future release.",
DeprecationWarning,
stacklevel=4,
)

def _get(self, path):
Expand Down

0 comments on commit 63a4f85

Please sign in to comment.