Skip to content

Commit

Permalink
Mention packaging on pkg_resources deprecation notes (#3949)
Browse files Browse the repository at this point in the history
  • Loading branch information
abravalheri committed Jun 19, 2023
2 parents 63a4f85 + 5e84450 commit 8f7c8ff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 2 additions & 0 deletions docs/pkg_resources.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ packages.
Use of ``pkg_resources`` is deprecated in favor of
:mod:`importlib.resources`, :mod:`importlib.metadata`
and their backports (:pypi:`importlib_resources`, :pypi:`importlib_metadata`).
Some useful APIs are also provided by :pypi:`packaging` (e.g. requirements
and version parsing).
Users should refrain from new usage of ``pkg_resources`` and
should work to port to importlib-based solutions.

Expand Down
16 changes: 8 additions & 8 deletions pkg_resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@
.zip files and with custom PEP 302 loaders that support the ``get_data()``
method.
This module is deprecated. Users are directed to
`importlib.resources <https://docs.python.org/3/library/importlib.resources.html>`_
and
`importlib.metadata <https://docs.python.org/3/library/importlib.metadata.html>`_
instead.
This module is deprecated. Users are directed to :mod:`importlib.resources`,
:mod:`importlib.metadata` and :pypi:`packaging` instead.
"""

import sys
Expand Down Expand Up @@ -118,9 +115,12 @@
_namespace_packages = None


warnings.warn("pkg_resources is deprecated as an API. "
"See https://setuptools.pypa.io/en/latest/pkg_resources.html",
DeprecationWarning, stacklevel=2)
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

0 comments on commit 8f7c8ff

Please sign in to comment.