Skip to content

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

typer/_typing.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
Union,
1414
)
1515

16-
from typing_extensions import Literal, get_args, get_origin
16+
if sys.version_info >= (3, 8):
17+
from typing import Literal, get_args, get_origin
18+
else:
19+
from typing_extensions import Literal, get_args, get_origin
1720

1821
if sys.version_info < (3, 10):
1922

typer/main.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
from uuid import UUID
1616

1717
import click
18-
from typing_extensions import get_args, get_origin
18+
if sys.version_info >= (3, 8):
19+
from typing import get_args, get_origin
20+
else:
21+
from typing_extensions import get_args, get_origin
1922

2023
from ._typing import is_union
2124
from .completion import get_completion_inspect_parameters

typer/utils.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,15 @@
33
from copy import copy
44
from typing import Any, Callable, Dict, List, Tuple, Type, cast
55

6-
from typing_extensions import Annotated, get_args, get_origin, get_type_hints
6+
if sys.version_info >= (3, 9):
7+
from typing import Annotated
8+
else:
9+
from typing_extensions import Annotated
10+
11+
if sys.version_info >= (3, 8):
12+
from typing import get_args, get_origin, get_type_hints
13+
else:
14+
from typing_extensions import get_args, get_origin, get_type_hints
715

816
from .models import ArgumentInfo, OptionInfo, ParameterInfo, ParamMeta
917

0 commit comments

Comments
 (0)