Skip to content

Vendoring updates for release 25.1 #13313

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/platformdirs.vendor.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Upgrade platformdirs to 4.3.7
1 change: 1 addition & 0 deletions news/rich.vendor.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Upgrade rich to 14.0.0
1 change: 1 addition & 0 deletions news/typing_extensions.vendor.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Upgrade typing_extensions to 4.13.2
10 changes: 10 additions & 0 deletions src/pip/_vendor/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,16 @@ Vendoring is automated via the `vendoring <https://pypi.org/project/vendoring/>`
Launch it via ``vendoring sync . -v`` (requires ``vendoring>=0.2.2``).
Tool configuration is done via ``pyproject.toml``.

To update the vendored library versions, we have a session defined in ``nox``.
The command to upgrade everything is::

nox -s vendoring -- --upgrade-all --skip urllib3 --skip setuptools

At the time of writing (April 2025) we do not upgrade ``urllib3`` because the
next version is a major upgrade and will be handled as an independent PR. We also
do not upgrade ``setuptools``, because we only rely on ``pkg_resources``, and
tracking every ``setuptools`` change is unnecessary for our needs.


Managing Local Patches
======================
Expand Down
40 changes: 20 additions & 20 deletions src/pip/_vendor/platformdirs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def _set_platform_dir_class() -> type[PlatformDirsABC]:

def user_data_dir(
appname: str | None = None,
appauthor: str | None | Literal[False] = None,
appauthor: str | Literal[False] | None = None,
version: str | None = None,
roaming: bool = False, # noqa: FBT001, FBT002
ensure_exists: bool = False, # noqa: FBT001, FBT002
Expand All @@ -76,7 +76,7 @@ def user_data_dir(

def site_data_dir(
appname: str | None = None,
appauthor: str | None | Literal[False] = None,
appauthor: str | Literal[False] | None = None,
version: str | None = None,
multipath: bool = False, # noqa: FBT001, FBT002
ensure_exists: bool = False, # noqa: FBT001, FBT002
Expand All @@ -100,7 +100,7 @@ def site_data_dir(

def user_config_dir(
appname: str | None = None,
appauthor: str | None | Literal[False] = None,
appauthor: str | Literal[False] | None = None,
version: str | None = None,
roaming: bool = False, # noqa: FBT001, FBT002
ensure_exists: bool = False, # noqa: FBT001, FBT002
Expand All @@ -124,7 +124,7 @@ def user_config_dir(

def site_config_dir(
appname: str | None = None,
appauthor: str | None | Literal[False] = None,
appauthor: str | Literal[False] | None = None,
version: str | None = None,
multipath: bool = False, # noqa: FBT001, FBT002
ensure_exists: bool = False, # noqa: FBT001, FBT002
Expand All @@ -148,7 +148,7 @@ def site_config_dir(

def user_cache_dir(
appname: str | None = None,
appauthor: str | None | Literal[False] = None,
appauthor: str | Literal[False] | None = None,
version: str | None = None,
opinion: bool = True, # noqa: FBT001, FBT002
ensure_exists: bool = False, # noqa: FBT001, FBT002
Expand All @@ -172,7 +172,7 @@ def user_cache_dir(

def site_cache_dir(
appname: str | None = None,
appauthor: str | None | Literal[False] = None,
appauthor: str | Literal[False] | None = None,
version: str | None = None,
opinion: bool = True, # noqa: FBT001, FBT002
ensure_exists: bool = False, # noqa: FBT001, FBT002
Expand All @@ -196,7 +196,7 @@ def site_cache_dir(

def user_state_dir(
appname: str | None = None,
appauthor: str | None | Literal[False] = None,
appauthor: str | Literal[False] | None = None,
version: str | None = None,
roaming: bool = False, # noqa: FBT001, FBT002
ensure_exists: bool = False, # noqa: FBT001, FBT002
Expand All @@ -220,7 +220,7 @@ def user_state_dir(

def user_log_dir(
appname: str | None = None,
appauthor: str | None | Literal[False] = None,
appauthor: str | Literal[False] | None = None,
version: str | None = None,
opinion: bool = True, # noqa: FBT001, FBT002
ensure_exists: bool = False, # noqa: FBT001, FBT002
Expand Down Expand Up @@ -274,7 +274,7 @@ def user_desktop_dir() -> str:

def user_runtime_dir(
appname: str | None = None,
appauthor: str | None | Literal[False] = None,
appauthor: str | Literal[False] | None = None,
version: str | None = None,
opinion: bool = True, # noqa: FBT001, FBT002
ensure_exists: bool = False, # noqa: FBT001, FBT002
Expand All @@ -298,7 +298,7 @@ def user_runtime_dir(

def site_runtime_dir(
appname: str | None = None,
appauthor: str | None | Literal[False] = None,
appauthor: str | Literal[False] | None = None,
version: str | None = None,
opinion: bool = True, # noqa: FBT001, FBT002
ensure_exists: bool = False, # noqa: FBT001, FBT002
Expand All @@ -322,7 +322,7 @@ def site_runtime_dir(

def user_data_path(
appname: str | None = None,
appauthor: str | None | Literal[False] = None,
appauthor: str | Literal[False] | None = None,
version: str | None = None,
roaming: bool = False, # noqa: FBT001, FBT002
ensure_exists: bool = False, # noqa: FBT001, FBT002
Expand All @@ -346,7 +346,7 @@ def user_data_path(

def site_data_path(
appname: str | None = None,
appauthor: str | None | Literal[False] = None,
appauthor: str | Literal[False] | None = None,
version: str | None = None,
multipath: bool = False, # noqa: FBT001, FBT002
ensure_exists: bool = False, # noqa: FBT001, FBT002
Expand All @@ -370,7 +370,7 @@ def site_data_path(

def user_config_path(
appname: str | None = None,
appauthor: str | None | Literal[False] = None,
appauthor: str | Literal[False] | None = None,
version: str | None = None,
roaming: bool = False, # noqa: FBT001, FBT002
ensure_exists: bool = False, # noqa: FBT001, FBT002
Expand All @@ -394,7 +394,7 @@ def user_config_path(

def site_config_path(
appname: str | None = None,
appauthor: str | None | Literal[False] = None,
appauthor: str | Literal[False] | None = None,
version: str | None = None,
multipath: bool = False, # noqa: FBT001, FBT002
ensure_exists: bool = False, # noqa: FBT001, FBT002
Expand All @@ -418,7 +418,7 @@ def site_config_path(

def site_cache_path(
appname: str | None = None,
appauthor: str | None | Literal[False] = None,
appauthor: str | Literal[False] | None = None,
version: str | None = None,
opinion: bool = True, # noqa: FBT001, FBT002
ensure_exists: bool = False, # noqa: FBT001, FBT002
Expand All @@ -442,7 +442,7 @@ def site_cache_path(

def user_cache_path(
appname: str | None = None,
appauthor: str | None | Literal[False] = None,
appauthor: str | Literal[False] | None = None,
version: str | None = None,
opinion: bool = True, # noqa: FBT001, FBT002
ensure_exists: bool = False, # noqa: FBT001, FBT002
Expand All @@ -466,7 +466,7 @@ def user_cache_path(

def user_state_path(
appname: str | None = None,
appauthor: str | None | Literal[False] = None,
appauthor: str | Literal[False] | None = None,
version: str | None = None,
roaming: bool = False, # noqa: FBT001, FBT002
ensure_exists: bool = False, # noqa: FBT001, FBT002
Expand All @@ -490,7 +490,7 @@ def user_state_path(

def user_log_path(
appname: str | None = None,
appauthor: str | None | Literal[False] = None,
appauthor: str | Literal[False] | None = None,
version: str | None = None,
opinion: bool = True, # noqa: FBT001, FBT002
ensure_exists: bool = False, # noqa: FBT001, FBT002
Expand Down Expand Up @@ -544,7 +544,7 @@ def user_desktop_path() -> Path:

def user_runtime_path(
appname: str | None = None,
appauthor: str | None | Literal[False] = None,
appauthor: str | Literal[False] | None = None,
version: str | None = None,
opinion: bool = True, # noqa: FBT001, FBT002
ensure_exists: bool = False, # noqa: FBT001, FBT002
Expand All @@ -568,7 +568,7 @@ def user_runtime_path(

def site_runtime_path(
appname: str | None = None,
appauthor: str | None | Literal[False] = None,
appauthor: str | Literal[False] | None = None,
version: str | None = None,
opinion: bool = True, # noqa: FBT001, FBT002
ensure_exists: bool = False, # noqa: FBT001, FBT002
Expand Down
6 changes: 3 additions & 3 deletions src/pip/_vendor/platformdirs/android.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Android(PlatformDirsABC):
@property
def user_data_dir(self) -> str:
""":return: data directory tied to the user, e.g. ``/data/user/<userid>/<packagename>/files/<AppName>``"""
return self._append_app_name_and_version(cast(str, _android_folder()), "files")
return self._append_app_name_and_version(cast("str", _android_folder()), "files")

@property
def site_data_dir(self) -> str:
Expand All @@ -36,7 +36,7 @@ def user_config_dir(self) -> str:
:return: config directory tied to the user, e.g. \
``/data/user/<userid>/<packagename>/shared_prefs/<AppName>``
"""
return self._append_app_name_and_version(cast(str, _android_folder()), "shared_prefs")
return self._append_app_name_and_version(cast("str", _android_folder()), "shared_prefs")

@property
def site_config_dir(self) -> str:
Expand All @@ -46,7 +46,7 @@ def site_config_dir(self) -> str:
@property
def user_cache_dir(self) -> str:
""":return: cache directory tied to the user, e.g.,``/data/user/<userid>/<packagename>/cache/<AppName>``"""
return self._append_app_name_and_version(cast(str, _android_folder()), "cache")
return self._append_app_name_and_version(cast("str", _android_folder()), "cache")

@property
def site_cache_dir(self) -> str:
Expand Down
5 changes: 3 additions & 2 deletions src/pip/_vendor/platformdirs/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from typing import Iterator, Literal
from collections.abc import Iterator
from typing import Literal


class PlatformDirsABC(ABC): # noqa: PLR0904
Expand All @@ -17,7 +18,7 @@ class PlatformDirsABC(ABC): # noqa: PLR0904
def __init__( # noqa: PLR0913, PLR0917
self,
appname: str | None = None,
appauthor: str | None | Literal[False] = None,
appauthor: str | Literal[False] | None = None,
version: str | None = None,
roaming: bool = False, # noqa: FBT001, FBT002
multipath: bool = False, # noqa: FBT001, FBT002
Expand Down
5 changes: 4 additions & 1 deletion src/pip/_vendor/platformdirs/unix.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@
import sys
from configparser import ConfigParser
from pathlib import Path
from typing import Iterator, NoReturn
from typing import TYPE_CHECKING, NoReturn

from .api import PlatformDirsABC

if TYPE_CHECKING:
from collections.abc import Iterator

if sys.platform == "win32":

def getuid() -> NoReturn:
Expand Down
13 changes: 9 additions & 4 deletions src/pip/_vendor/platformdirs/version.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# file generated by setuptools_scm
# file generated by setuptools-scm
# don't change, don't track in version control

__all__ = ["__version__", "__version_tuple__", "version", "version_tuple"]

TYPE_CHECKING = False
if TYPE_CHECKING:
from typing import Tuple, Union
from typing import Tuple
from typing import Union

VERSION_TUPLE = Tuple[Union[int, str], ...]
else:
VERSION_TUPLE = object
Expand All @@ -12,5 +17,5 @@
__version_tuple__: VERSION_TUPLE
version_tuple: VERSION_TUPLE

__version__ = version = '4.3.6'
__version_tuple__ = version_tuple = (4, 3, 6)
__version__ = version = '4.3.7'
__version_tuple__ = version_tuple = (4, 3, 7)
28 changes: 21 additions & 7 deletions src/pip/_vendor/rich/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ def group(fit: bool = True) -> Callable[..., Callable[..., Group]]:
"""

def decorator(
method: Callable[..., Iterable[RenderableType]]
method: Callable[..., Iterable[RenderableType]],
) -> Callable[..., Group]:
"""Convert a method that returns an iterable of renderables in to a Group."""

Expand Down Expand Up @@ -735,7 +735,9 @@ def __init__(
self.get_time = get_time or monotonic
self.style = style
self.no_color = (
no_color if no_color is not None else "NO_COLOR" in self._environ
no_color
if no_color is not None
else self._environ.get("NO_COLOR", "") != ""
)
self.is_interactive = (
(self.is_terminal and not self.is_dumb_terminal)
Expand Down Expand Up @@ -933,11 +935,13 @@ def is_terminal(self) -> bool:

Returns:
bool: True if the console writing to a device capable of
understanding terminal codes, otherwise False.
understanding escape sequences, otherwise False.
"""
# If dev has explicitly set this value, return it
if self._force_terminal is not None:
return self._force_terminal

# Fudge for Idle
if hasattr(sys.stdin, "__module__") and sys.stdin.__module__.startswith(
"idlelib"
):
Expand All @@ -948,12 +952,22 @@ def is_terminal(self) -> bool:
# return False for Jupyter, which may have FORCE_COLOR set
return False

# If FORCE_COLOR env var has any value at all, we assume a terminal.
force_color = self._environ.get("FORCE_COLOR")
if force_color is not None:
self._force_terminal = True
environ = self._environ

tty_compatible = environ.get("TTY_COMPATIBLE", "")
# 0 indicates device is not tty compatible
if tty_compatible == "0":
return False
# 1 indicates device is tty compatible
if tty_compatible == "1":
return True

# https://force-color.org/
force_color = environ.get("FORCE_COLOR")
if force_color is not None:
return force_color != ""

# Any other value defaults to auto detect
isatty: Optional[Callable[[], bool]] = getattr(self.file, "isatty", None)
try:
return False if isatty is None else isatty()
Expand Down
4 changes: 3 additions & 1 deletion src/pip/_vendor/rich/default_styles.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@
"traceback.exc_type": Style(color="bright_red", bold=True),
"traceback.exc_value": Style.null(),
"traceback.offset": Style(color="bright_red", bold=True),
"traceback.error_range": Style(underline=True, bold=True, dim=False),
"traceback.error_range": Style(underline=True, bold=True),
"traceback.note": Style(color="green", bold=True),
"traceback.group.border": Style(color="magenta"),
"bar.back": Style(color="grey23"),
"bar.complete": Style(color="rgb(249,38,114)"),
"bar.finished": Style(color="rgb(114,156,31)"),
Expand Down
13 changes: 7 additions & 6 deletions src/pip/_vendor/rich/diagnose.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,17 @@ def report() -> None: # pragma: no cover
inspect(features)

env_names = (
"TERM",
"COLORTERM",
"CLICOLOR",
"NO_COLOR",
"TERM_PROGRAM",
"COLORTERM",
"COLUMNS",
"LINES",
"JPY_PARENT_PID",
"JUPYTER_COLUMNS",
"JUPYTER_LINES",
"JPY_PARENT_PID",
"LINES",
"NO_COLOR",
"TERM_PROGRAM",
"TERM",
"TTY_COMPATIBLE",
"VSCODE_VERBOSE_LOGGING",
)
env = {name: os.getenv(name) for name in env_names}
Expand Down
2 changes: 1 addition & 1 deletion src/pip/_vendor/rich/panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Panel(JupyterMixin):
Args:
renderable (RenderableType): A console renderable object.
box (Box, optional): A Box instance that defines the look of the border (see :ref:`appendix_box`. Defaults to box.ROUNDED.
box (Box): A Box instance that defines the look of the border (see :ref:`appendix_box`. Defaults to box.ROUNDED.
title (Optional[TextType], optional): Optional title displayed in panel header. Defaults to None.
title_align (AlignMethod, optional): Alignment of title. Defaults to "center".
subtitle (Optional[TextType], optional): Optional subtitle displayed in panel footer. Defaults to None.
Expand Down
Loading