@@ -30,16 +30,19 @@ def _should_use_importlib_metadata() -> bool:
30
30
"""Whether to use the ``importlib.metadata`` or ``pkg_resources`` backend.
31
31
32
32
By default, pip uses ``importlib.metadata`` on Python 3.11+, and
33
- ``pkg_resourcess`` otherwise. This can be overridden by a couple of ways:
33
+ ``pkg_resources`` otherwise. Up to Python 3.12, This can be
34
+ overridden by a couple of ways:
34
35
35
36
* If environment variable ``_PIP_USE_IMPORTLIB_METADATA`` is set, it
36
- dictates whether ``importlib.metadata`` is used, regardless of Python
37
- version.
38
- * On Python 3.11+, Python distributors can patch ``importlib.metadata``
39
- to add a global constant ``_PIP_USE_IMPORTLIB_METADATA = False``. This
40
- makes pip use ``pkg_resources`` (unless the user set the aforementioned
41
- environment variable to *True*).
37
+ dictates whether ``importlib.metadata`` is used, for Python <3.13.
38
+ * On Python 3.11, 3.12 and 3.13, Python distributors can patch
39
+ ``importlib.metadata`` to add a global constant
40
+ ``_PIP_USE_IMPORTLIB_METADATA = False``. This makes pip use
41
+ ``pkg_resources`` (unless the user set the aforementioned environment
42
+ variable to *True*).
42
43
"""
44
+ if sys .version_info >= (3 , 13 ):
45
+ return True
43
46
with contextlib .suppress (KeyError , ValueError ):
44
47
return bool (strtobool (os .environ ["_PIP_USE_IMPORTLIB_METADATA" ]))
45
48
if sys .version_info < (3 , 11 ):
0 commit comments