diff --git a/pyproject.toml b/pyproject.toml index 54c9e380..c85dff69 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,7 @@ dependencies = [ "particle", "python-constraint", "tqdm >=4.24.0", # autonotebook - 'typing-extensions; python_version <"3.10.0"', # typing.TypeAlias + 'typing-extensions; python_version <"3.10.0"', # Literal, Protocol, TypeAlias ] description = "Rule-based particle reaction problem solver on a quantum number level" dynamic = ["version"] diff --git a/src/qrules/transition.py b/src/qrules/transition.py index 59e683ae..9eca9f67 100644 --- a/src/qrules/transition.py +++ b/src/qrules/transition.py @@ -10,7 +10,7 @@ from copy import copy, deepcopy from enum import Enum, auto from multiprocessing import Pool -from typing import TYPE_CHECKING, Iterable, Literal, Sequence, overload +from typing import TYPE_CHECKING, Iterable, Sequence, overload import attrs from attrs import define, field, frozen @@ -74,6 +74,11 @@ create_n_body_topology, ) +if sys.version_info >= (3, 8): + from typing import Literal +else: + from typing_extensions import Literal + if sys.version_info >= (3, 10): from typing import TypeAlias else: