Skip to content

Commit 0cfb987

Browse files
committed
Add warning to pkg_resources section & fix link
1 parent c0a7bd9 commit 0cfb987

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

source/guides/handling-missing-extras-at-runtime.rst

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,20 @@ because another installed package depends on it with a wider version
4545
requirement than specified by your extra).
4646

4747

48-
Using ``pkg_resources``
49-
-----------------------
48+
Using ``pkg_resources`` (deprecated)
49+
------------------------------------
5050

51-
The now-deprecated :ref:`pkg_resources <ResourceManager API>` package (part of
52-
the ``setuptools`` distribution) provides a ``require`` function that you can
53-
use to check if a given optional dependency of your package is installed or
54-
not:
51+
.. attention::
5552

56-
.. :: TODO ask setuptools to add labels for pkg_resources & require, then link
57-
properly
53+
``pkg_resources`` is **deprecated** and the PyPA **strongly discourages**
54+
its use.
55+
This method is included in this guide for completeness's sake and only until
56+
functionality with a similar level of comfort exists in
57+
``importlib.metadata`` or ``packaging``.
5858

59+
The now-deprecated `pkg_resources <pkg_resources_>`_ package (part of the
60+
``setuptools`` distribution) provides a ``require`` function that you can use
61+
to check if a given optional dependency of your package is installed or not:
5962

6063
.. code-block:: python
6164
@@ -209,6 +212,8 @@ TODO mention that you might want to provide a way for users to check
209212

210213
------------------
211214

215+
.. _pkg_resources: https://setuptools.pypa.io/en/latest/pkg_resources.html
216+
212217
.. _packaging-problems-317: https://github.com/pypa/packaging-problems/issues/317
213218

214219
.. _packaging-problems-664: https://github.com/pypa/packaging-problems/issues/664

0 commit comments

Comments
 (0)