Skip to content

Commit

Permalink
Merge pull request #211 from qarkai/typing_extensions
Browse files Browse the repository at this point in the history
Use typing_extensions only when needed
  • Loading branch information
jaraco authored Jun 20, 2024
2 parents 1b1b0f2 + c6538dc commit 0bd7536
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
4 changes: 3 additions & 1 deletion inflect/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
Dict,
Iterable,
List,
Literal,
Match,
Optional,
Sequence,
Expand All @@ -78,7 +79,8 @@

from more_itertools import windowed_complete
from typeguard import typechecked
from typing_extensions import Annotated, Literal

from .compat.py38 import Annotated


class UnknownClassicalModeError(Exception):
Expand Down
Empty file added inflect/compat/__init__.py
Empty file.
7 changes: 7 additions & 0 deletions inflect/compat/py38.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import sys


if sys.version_info > (3, 9):
from typing import Annotated
else: # pragma: no cover
from typing_extensions import Annotated # noqa: F401
1 change: 1 addition & 0 deletions newsfragments/211.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Restricted typing_extensions to Python 3.8.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ requires-python = ">=3.8"
dependencies = [
"more_itertools",
"typeguard >= 4.0.1",
"typing_extensions",
"typing_extensions ; python_version<'3.9'",
]
keywords = [
"plural",
Expand Down

0 comments on commit 0bd7536

Please sign in to comment.