diff --git a/swcc/setup.py b/swcc/setup.py index 3b8a0085..1d21db02 100644 --- a/swcc/setup.py +++ b/swcc/setup.py @@ -43,6 +43,7 @@ 'rich', 'toml', 'tqdm', + 'typing-extensions ; python_version < "3.8"', ], entry_points={'console_scripts': ['swcc=swcc.cli:main']}, extras_require={'dev': ['factory_boy', 'ipython', 'tox']}, diff --git a/swcc/swcc/models.py b/swcc/swcc/models.py index e431a2c9..0397a509 100644 --- a/swcc/swcc/models.py +++ b/swcc/swcc/models.py @@ -2,19 +2,38 @@ from pathlib import Path, PurePath from tempfile import TemporaryDirectory -from typing import ( - Any, - Dict, - Generic, - Iterator, - Literal, - Optional, - Tuple, - Type, - TypeVar, - Union, - get_args, -) + +try: + from typing import ( + Any, + Dict, + Generic, + Iterator, + Literal, + Optional, + Tuple, + Type, + TypeVar, + Union, + get_args, + ) +except ImportError: + from typing import ( + Any, + Dict, + Generic, + Iterator, + Optional, + Tuple, + Type, + TypeVar, + Union, + ) + from typing_extensions import ( # type: ignore + Literal, + get_args, + ) + from urllib.parse import unquote from openpyxl import load_workbook diff --git a/swcc/tox.ini b/swcc/tox.ini index 0dd9eb80..44db4ac4 100644 --- a/swcc/tox.ini +++ b/swcc/tox.ini @@ -55,6 +55,21 @@ deps = commands = pytest {posargs} +[testenv:py37] +install_command = pip install --ignore-requires-python {opts} {packages} +basepython=python3.7 +passenv = + DJANGO_BASE_URL + DJANGO_SUPERUSER_EMAIL + DJANGO_SUPERUSER_PASSWORD +deps = + pytest + click + pytest-factoryboy + pytest-mock +commands = + pytest {posargs} + [testenv:release] skipsdist = true skip_install = true