Skip to content

Commit

Permalink
Mention 'packaging' on pkg_resources deprecation notes
Browse files Browse the repository at this point in the history
  • Loading branch information
abravalheri committed Jun 13, 2023
1 parent 028ce3c commit 5e84450
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 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
13 changes: 7 additions & 6 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,7 +115,11 @@
_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
)


_PEP440_FALLBACK = re.compile(r"^v?(?P<safe>(?:[0-9]+!)?[0-9]+(?:\.[0-9]+)*)", re.I)
Expand Down

0 comments on commit 5e84450

Please sign in to comment.