Skip to content

Commit 9d940bd

Browse files
committed
Remove the need for typing-extensions
1 parent 936f01a commit 9d940bd

File tree

5 files changed

+7
-20
lines changed

5 files changed

+7
-20
lines changed

relenv/build/common.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,7 @@
3838
cast,
3939
)
4040

41-
try:
42-
from typing import TYPE_CHECKING
43-
except ImportError: # pragma: no cover
44-
TYPE_CHECKING = False
45-
46-
from typing_extensions import Protocol, TypedDict
41+
from typing import TYPE_CHECKING, Protocol, TypedDict
4742

4843
if TYPE_CHECKING:
4944
from multiprocessing.synchronize import Event as SyncEvent

relenv/common.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@
2020
import textwrap
2121
import threading
2222
import time
23-
from typing import IO, Any, BinaryIO, Iterable, Mapping, Optional, Union, cast
24-
25-
from typing_extensions import Literal
23+
from typing import IO, Any, BinaryIO, Iterable, Literal, Mapping, Optional, Union, cast
2624

2725
# Re-export frequently monkeypatched modules for type checking.
2826
os = _os

setup.cfg

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ packages = find:
1717
package_dir =
1818
relenv = relenv
1919
include_package_data = True
20-
install_requires =
21-
typing-extensions
2220

2321
[options.entry_points]
2422
console_scripts =
@@ -64,7 +62,9 @@ ignore =
6462
# F405 '*' may be undefined, or defined from star imports: *
6563
F405
6664
# line break before binary operator, black does this with pathlib.Path objects
67-
W503
65+
W503,
66+
# TYP001 guard import by TYPE_CHECKING (not needed for py3.10+)
67+
TYP001
6868

6969
per-file-ignores =
7070
# F401 imported but unused

tests/test_common.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@
1111
import sys
1212
import tarfile
1313
from types import ModuleType
14-
from typing import BinaryIO
14+
from typing import BinaryIO, Literal
1515
from unittest.mock import patch
1616

1717
import pytest
18-
from typing_extensions import Literal
1918

2019
import relenv.common
2120
from relenv.common import (

tests/test_module_imports.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,7 @@
55

66
import importlib
77
import pathlib
8-
from typing import Any, Callable, List, Sequence, TypeVar, cast
9-
10-
try:
11-
from typing import TYPE_CHECKING
12-
except ImportError: # pragma: no cover
13-
TYPE_CHECKING = False
8+
from typing import TYPE_CHECKING, Any, Callable, List, Sequence, TypeVar, cast
149

1510
import pytest
1611

0 commit comments

Comments
 (0)