Skip to content

Commit 28bb1b8

Browse files
authored
Merge pull request #13336 from ichard26/removal/typing-extensions
Remove vendored typing-extensions
2 parents 687742a + 4af2afe commit 28bb1b8

30 files changed

+178
-4701
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ repos:
4141
'types-setuptools==68.2.0.0',
4242
'types-freezegun==1.1.10',
4343
'types-pyyaml==6.0.12.12',
44+
'typing-extensions',
4445
]
4546

4647
- repo: https://github.com/pre-commit/pygrep-hooks

news/rich.vendor.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Upgrade rich to 14.1.0

news/typing_extensions.vendor.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Upgrade typing_extensions to 4.14.1
1+
Remove vendored typing-extensions.

src/pip/_internal/index/package_finder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
from pip._internal.utils.unpacking import SUPPORTED_EXTENSIONS
4646

4747
if TYPE_CHECKING:
48-
from pip._vendor.typing_extensions import TypeGuard
48+
from typing_extensions import TypeGuard
4949

5050
__all__ = ["FormatControl", "BestCandidateResult", "PackageFinder"]
5151

src/pip/_internal/models/pylock.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,18 @@
55
from collections.abc import Iterable
66
from dataclasses import dataclass
77
from pathlib import Path
8-
from typing import Any
8+
from typing import TYPE_CHECKING, Any
99

1010
from pip._vendor import tomli_w
11-
from pip._vendor.typing_extensions import Self
1211

1312
from pip._internal.models.direct_url import ArchiveInfo, DirInfo, VcsInfo
1413
from pip._internal.models.link import Link
1514
from pip._internal.req.req_install import InstallRequirement
1615
from pip._internal.utils.urls import url_to_path
1716

17+
if TYPE_CHECKING:
18+
from typing_extensions import Self
19+
1820
PYLOCK_FILE_NAME_RE = re.compile(r"^pylock\.([^.]+)\.toml$")
1921

2022

src/pip/_internal/utils/retry.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1+
from __future__ import annotations
2+
13
import functools
24
from time import perf_counter, sleep
3-
from typing import Callable, TypeVar
5+
from typing import TYPE_CHECKING, Callable, TypeVar
46

5-
from pip._vendor.typing_extensions import ParamSpec
7+
if TYPE_CHECKING:
8+
from typing_extensions import ParamSpec
69

7-
T = TypeVar("T")
8-
P = ParamSpec("P")
10+
T = TypeVar("T")
11+
P = ParamSpec("P")
912

1013

1114
def retry(

src/pip/_vendor/pkg_resources/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100

101101
if TYPE_CHECKING:
102102
from _typeshed import BytesPath, StrPath, StrOrBytesPath
103-
from pip._vendor.typing_extensions import Self
103+
from typing_extensions import Self
104104

105105

106106
# Patch: Remove deprecation warning from vendored pkg_resources.

src/pip/_vendor/rich/__main__.py

Lines changed: 12 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,8 @@ def iter_last(values: Iterable[T]) -> Iterable[Tuple[bool, T]]:
207207

208208

209209
if __name__ == "__main__": # pragma: no cover
210+
from pip._vendor.rich.panel import Panel
211+
210212
console = Console(
211213
file=io.StringIO(),
212214
force_terminal=True,
@@ -227,47 +229,17 @@ def iter_last(values: Iterable[T]) -> Iterable[Tuple[bool, T]]:
227229
c = Console(record=True)
228230
c.print(test_card)
229231

230-
print(f"rendered in {pre_cache_taken}ms (cold cache)")
231-
print(f"rendered in {taken}ms (warm cache)")
232-
233-
from pip._vendor.rich.panel import Panel
234-
235232
console = Console()
236-
237-
sponsor_message = Table.grid(padding=1)
238-
sponsor_message.add_column(style="green", justify="right")
239-
sponsor_message.add_column(no_wrap=True)
240-
241-
sponsor_message.add_row(
242-
"Textualize",
243-
"[u blue link=https://github.com/textualize]https://github.com/textualize",
244-
)
245-
sponsor_message.add_row(
246-
"Twitter",
247-
"[u blue link=https://twitter.com/willmcgugan]https://twitter.com/willmcgugan",
248-
)
249-
250-
intro_message = Text.from_markup(
251-
"""\
252-
We hope you enjoy using Rich!
253-
254-
Rich is maintained with [red]:heart:[/] by [link=https://www.textualize.io]Textualize.io[/]
255-
256-
- Will McGugan"""
257-
)
258-
259-
message = Table.grid(padding=2)
260-
message.add_column()
261-
message.add_column(no_wrap=True)
262-
message.add_row(intro_message, sponsor_message)
263-
233+
console.print(f"[dim]rendered in [not dim]{pre_cache_taken}ms[/] (cold cache)")
234+
console.print(f"[dim]rendered in [not dim]{taken}ms[/] (warm cache)")
235+
console.print()
264236
console.print(
265237
Panel.fit(
266-
message,
267-
box=box.ROUNDED,
268-
padding=(1, 2),
269-
title="[b red]Thanks for trying out Rich!",
270-
border_style="bright_blue",
271-
),
272-
justify="center",
238+
"[b magenta]Hope you enjoy using Rich![/]\n\n"
239+
"Please consider sponsoring me if you get value from my work.\n\n"
240+
"Even the price of a ☕ can brighten my day!\n\n"
241+
"https://github.com/sponsors/willmcgugan",
242+
border_style="red",
243+
title="Help ensure Rich is maintained",
244+
)
273245
)

src/pip/_vendor/rich/_inspect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def safe_getattr(attr_name: str) -> Tuple[Any, Any]:
214214
def _get_formatted_doc(self, object_: Any) -> Optional[str]:
215215
"""
216216
Extract the docstring of an object, process it and returns it.
217-
The processing consists in cleaning up the doctring's indentation,
217+
The processing consists in cleaning up the docstring's indentation,
218218
taking only its 1st paragraph if `self.help` is not True,
219219
and escape its control codes.
220220

src/pip/_vendor/rich/_ratio.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
import sys
21
from fractions import Fraction
32
from math import ceil
4-
from typing import cast, List, Optional, Sequence
5-
6-
if sys.version_info >= (3, 8):
7-
from typing import Protocol
8-
else:
9-
from pip._vendor.typing_extensions import Protocol # pragma: no cover
3+
from typing import cast, List, Optional, Sequence, Protocol
104

115

126
class Edge(Protocol):

0 commit comments

Comments
 (0)