Skip to content

Commit eebbb02

Browse files
authored
Only import from typing_extensions if TYPE_CHECKING (#52)
1 parent 9cfe47c commit eebbb02

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

src/dags/output.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
import inspect
55
from typing import TYPE_CHECKING, overload
66

7-
from typing_extensions import Unpack
8-
97
from dags.exceptions import DagsError
108

119
if TYPE_CHECKING:
1210
from collections.abc import Callable
1311

12+
from typing_extensions import Unpack
13+
1414
from dags.typing import MixedTupleType, P, T
1515

1616

src/dags/typing.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
from __future__ import annotations
22

3-
from typing import ParamSpec, TypeVar
3+
from typing import TYPE_CHECKING, ParamSpec, TypeVar
44

5-
from typing_extensions import TypeVarTuple
5+
if TYPE_CHECKING:
6+
from typing_extensions import TypeVarTuple
67

7-
# ParamSpec representing the full signature (positional and keyword parameters) of a
8-
# callable
9-
P = ParamSpec("P")
10-
# TypeVar representing the return type of a callable
11-
R = TypeVar("R")
12-
# Generic type variable for use in type constructors
13-
T = TypeVar("T")
14-
# Variadic TypeVar for tuples of arbitrary length with heterogeneous element types
15-
MixedTupleType = TypeVarTuple("MixedTupleType")
8+
# ParamSpec representing the full signature (positional and keyword parameters) of a
9+
# callable
10+
P = ParamSpec("P")
11+
# TypeVar representing the return type of a callable
12+
R = TypeVar("R")
13+
# Generic type variable for use in type constructors
14+
T = TypeVar("T")
15+
# Variadic TypeVar for tuples of arbitrary length with heterogeneous element types
16+
MixedTupleType = TypeVarTuple("MixedTupleType")

0 commit comments

Comments
 (0)