diff --git a/inflect/__init__.py b/inflect/__init__.py index d0eded1..361f46e 100644 --- a/inflect/__init__.py +++ b/inflect/__init__.py @@ -68,6 +68,7 @@ Dict, Iterable, List, + Literal, Match, Optional, Sequence, @@ -78,7 +79,11 @@ from more_itertools import windowed_complete from typeguard import typechecked -from typing_extensions import Annotated, Literal +try: + # Python 3.9+ + from typing import Annotated +except ImportError: + from typing_extensions import Annotated class UnknownClassicalModeError(Exception): diff --git a/pyproject.toml b/pyproject.toml index 1cb9e5e..cb5a0a3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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",