diff --git a/deepmd/infer/model_devi.py b/deepmd/infer/model_devi.py index 6b0b3c340a..8c329a0845 100644 --- a/deepmd/infer/model_devi.py +++ b/deepmd/infer/model_devi.py @@ -1,6 +1,5 @@ # SPDX-License-Identifier: LGPL-3.0-or-later from typing import ( - Literal, Optional, Tuple, overload, @@ -22,6 +21,11 @@ DeepPot, ) +try: + from typing import Literal # python >=3.8 +except ImportError: + from typing_extensions import Literal # type: ignore + @overload def calc_model_devi_f( diff --git a/pyproject.toml b/pyproject.toml index 687e0284cc..e7eaed3253 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,7 +43,7 @@ dependencies = [ 'pyyaml', 'dargs >= 0.3.5', 'python-hostlist >= 1.21', - 'typing_extensions; python_version < "3.7"', + 'typing_extensions; python_version < "3.8"', 'importlib_metadata>=1.4; python_version < "3.8"', 'h5py', 'wcmatch',