diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cb1af8b..dab6f73 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: - python-version: ["3.8", "3.9", "3.10"] + python-version: ["3.7", "3.8", "3.9", "3.10"] operating-system: [windows-latest, ubuntu-latest] runs-on: ${{ matrix.operating-system }} diff --git a/great_ai/deploy/great_ai.py b/great_ai/deploy/great_ai.py index 9ce0395..c784548 100644 --- a/great_ai/deploy/great_ai.py +++ b/great_ai/deploy/great_ai.py @@ -6,7 +6,6 @@ from typing import ( Callable, Generic, List, - Literal, Optional, Sequence, Tuple, @@ -19,6 +18,7 @@ from typing import ( from async_lru import alru_cache from fastapi import FastAPI from tqdm.cli import tqdm +from typing_extensions import Literal # <= Python 3.7 from ..constants import DASHBOARD_PATH from ..context import get_context diff --git a/great_ai/large_file/large_file/large_file_base.py b/great_ai/large_file/large_file/large_file_base.py index 7264520..9140619 100644 --- a/great_ai/large_file/large_file/large_file_base.py +++ b/great_ai/large_file/large_file/large_file_base.py @@ -5,7 +5,9 @@ from abc import ABC, abstractmethod from functools import lru_cache from pathlib import Path from types import TracebackType -from typing import IO, Any, List, Literal, Optional, Type, Union, cast +from typing import IO, Any, List, Optional, Type, Union, cast + +from typing_extensions import Literal # <= Python 3.7 from great_ai.utilities import ConfigFile, get_logger diff --git a/great_ai/models/use_model.py b/great_ai/models/use_model.py index e18eff8..5fcca36 100644 --- a/great_ai/models/use_model.py +++ b/great_ai/models/use_model.py @@ -1,19 +1,8 @@ from functools import wraps -from typing import ( - Any, - Callable, - Dict, - List, - Literal, - Optional, - Set, - Tuple, - TypeVar, - Union, - cast, -) +from typing import Any, Callable, Dict, List, Optional, Set, Tuple, TypeVar, Union, cast from dill import load +from typing_extensions import Literal # <= Python 3.7 from ..context import get_context from ..helper import get_function_metadata_store diff --git a/great_ai/tracing/tracing_context.py b/great_ai/tracing/tracing_context.py index 28dc52b..c322f8a 100644 --- a/great_ai/tracing/tracing_context.py +++ b/great_ai/tracing/tracing_context.py @@ -2,9 +2,11 @@ from contextvars import ContextVar from datetime import datetime from time import perf_counter from types import TracebackType -from typing import Any, Dict, Generic, List, Literal, Optional, Type, TypeVar, cast +from typing import Any, Dict, Generic, List, Optional, Type, TypeVar, cast from uuid import uuid4 +from typing_extensions import Literal # <= Python 3.7 + from ..constants import DEVELOPMENT_TAG_NAME, ONLINE_TAG_NAME, PRODUCTION_TAG_NAME from ..context import get_context from ..views import Model, Trace diff --git a/great_ai/utilities/parallel_map/parallel_map.py b/great_ai/utilities/parallel_map/parallel_map.py index 098d678..fa109a5 100644 --- a/great_ai/utilities/parallel_map/parallel_map.py +++ b/great_ai/utilities/parallel_map/parallel_map.py @@ -3,7 +3,6 @@ from typing import ( Awaitable, Callable, Iterable, - Literal, Optional, Sequence, TypeVar, @@ -12,6 +11,7 @@ from typing import ( ) import dill +from typing_extensions import Literal # <= Python 3.7 from .get_config import get_config from .manage_communication import manage_communication diff --git a/great_ai/utilities/parallel_map/threaded_parallel_map.py b/great_ai/utilities/parallel_map/threaded_parallel_map.py index faf0b48..a751a06 100644 --- a/great_ai/utilities/parallel_map/threaded_parallel_map.py +++ b/great_ai/utilities/parallel_map/threaded_parallel_map.py @@ -4,7 +4,6 @@ from typing import ( Awaitable, Callable, Iterable, - Literal, Optional, Sequence, TypeVar, @@ -12,6 +11,8 @@ from typing import ( overload, ) +from typing_extensions import Literal # <= Python 3.7 + from .get_config import get_config from .manage_communication import manage_communication from .mapper_function import mapper_function diff --git a/great_ai/views/operators.py b/great_ai/views/operators.py index 071e266..3bd2624 100644 --- a/great_ai/views/operators.py +++ b/great_ai/views/operators.py @@ -1,4 +1,6 @@ -from typing import List, Literal +from typing import List + +from typing_extensions import Literal # <= Python 3.7 Operator = Literal[">=", "<=", "<", ">", "!=", "=", "contains"] diff --git a/great_ai/views/outputs/sequence_labeling_output.py b/great_ai/views/outputs/sequence_labeling_output.py index 131d8f2..a1a156f 100644 --- a/great_ai/views/outputs/sequence_labeling_output.py +++ b/great_ai/views/outputs/sequence_labeling_output.py @@ -1,4 +1,6 @@ -from typing import Any, List, Literal, Optional +from typing import Any, List, Optional + +from typing_extensions import Literal # <= Python 3.7 from ..hashable_base_model import HashableBaseModel diff --git a/great_ai/views/sort_by.py b/great_ai/views/sort_by.py index d0f8eff..aa92fcc 100644 --- a/great_ai/views/sort_by.py +++ b/great_ai/views/sort_by.py @@ -1,6 +1,5 @@ -from typing import Literal - from pydantic import BaseModel +from typing_extensions import Literal # <= Python 3.7 class SortBy(BaseModel):