From 6ac8f442582a66539ee42ef27e39377db480ed2c Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Mon, 11 Sep 2023 00:29:25 -0400 Subject: [PATCH] import Literal from typing_extensions for py37 --- deepmd/infer/model_devi.py | 6 +++++- pyproject.toml | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) 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',