Skip to content

Commit

Permalink
Force use of typeddict from typingexentions, pin poetry in tests, sim…
Browse files Browse the repository at this point in the history
…ple disable python 3.8 (#2185)

* import correct typeddict version for use in pydantic, disallow use of usual python typeddict imports

* add test

* update import for examples

* fixed some imports

* remove python 3.8 lint and test for now

* always use typeddict from typing_extensions
pin poetry in tests to 1.8.5
  • Loading branch information
sh-rp authored Jan 9, 2025
1 parent 662d4c9 commit c7c3370
Show file tree
Hide file tree
Showing 50 changed files with 84 additions and 34 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
matrix:
os:
- ubuntu-latest
python-version: ["3.8.x", "3.9.x", "3.10.x", "3.11.x"]
python-version: ["3.9.x", "3.10.x", "3.11.x"]

defaults:
run:
Expand All @@ -49,6 +49,7 @@ jobs:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
version: 1.8.5

- name: Load cached venv
id: cached-poetry-dependencies
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test_airflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
version: 1.8.5

- name: Load cached venv
id: cached-poetry-dependencies
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test_build_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
version: 1.8.5

- name: Build images
run: make test-build-images
3 changes: 1 addition & 2 deletions .github/workflows/test_common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ jobs:
python-version: ["3.11.x"]
# Test all python versions on ubuntu only
include:
- python-version: "3.8.x"
os: "ubuntu-latest"
- python-version: "3.9.x"
os: "ubuntu-latest"
- python-version: "3.10.x"
Expand Down Expand Up @@ -79,6 +77,7 @@ jobs:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
version: 1.8.5

# NOTE: do not cache. we want to have a clean state each run and we upgrade depdendencies later
# - name: Load cached venv
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test_dbt_cloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
version: 1.8.5

- name: Load cached venv
id: cached-poetry-dependencies
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test_dbt_runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
version: 1.8.5

- name: Load cached venv
id: cached-poetry-dependencies
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test_destination_athena.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ jobs:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
version: 1.8.5

- name: Load cached venv
id: cached-poetry-dependencies
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test_destination_athena_iceberg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ jobs:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
version: 1.8.5

- name: Load cached venv
id: cached-poetry-dependencies
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test_destination_bigquery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ jobs:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
version: 1.8.5

- name: Load cached venv
id: cached-poetry-dependencies
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test_destination_clickhouse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
version: 1.8.5

- name: Load cached venv
id: cached-poetry-dependencies
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test_destination_databricks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ jobs:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
version: 1.8.5

- name: Load cached venv
id: cached-poetry-dependencies
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test_destination_dremio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ jobs:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
version: 1.8.5

- name: Load cached venv
id: cached-poetry-dependencies
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test_destination_lancedb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
version: 1.8.5

- name: Load cached venv
id: cached-poetry-dependencies
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test_destination_motherduck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ jobs:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
version: 1.8.5

- name: Load cached venv
id: cached-poetry-dependencies
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test_destination_mssql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ jobs:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
version: 1.8.5

- name: Load cached venv
id: cached-poetry-dependencies
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test_destination_qdrant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ jobs:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
version: 1.8.5

- name: Load cached venv
id: cached-poetry-dependencies
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test_destination_snowflake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ jobs:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
version: 1.8.5

- name: Load cached venv
id: cached-poetry-dependencies
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test_destination_synapse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ jobs:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
version: 1.8.5

- name: Load cached venv
id: cached-poetry-dependencies
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test_destinations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ jobs:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
version: 1.8.5

# - name: Load cached venv
# id: cached-poetry-dependencies
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test_doc_snippets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ jobs:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
version: 1.8.5

- name: Load cached venv
id: cached-poetry-dependencies
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test_local_destinations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ jobs:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
version: 1.8.5

- name: Load cached venv
id: cached-poetry-dependencies
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test_local_sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ jobs:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
version: 1.8.5

- name: Load cached venv
id: cached-poetry-dependencies
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test_sqlalchemy_destinations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ jobs:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
version: 1.8.5

- name: Load cached venv
id: cached-poetry-dependencies
Expand Down
3 changes: 2 additions & 1 deletion dlt/cli/pipeline_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
import yaml
import posixpath
from pathlib import Path
from typing import Dict, NamedTuple, Sequence, Tuple, TypedDict, List, Literal
from typing import Dict, NamedTuple, Sequence, Tuple, List, Literal
from dlt.cli.exceptions import VerifiedSourceRepoError

from dlt.common import git
from dlt.common.storages import FileStorage
from dlt.common.typing import TypedDict

from dlt.common.reflection.utils import get_module_docstring

Expand Down
3 changes: 2 additions & 1 deletion dlt/common/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, AnyStr, Dict, List, Sequence, Optional, Iterable, Type, TypedDict
from typing import Any, AnyStr, Dict, List, Sequence, Optional, Type
from dlt.common.typing import TypedDict


class ExceptionTrace(TypedDict, total=False):
Expand Down
4 changes: 1 addition & 3 deletions dlt/common/incremental/typing.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from typing_extensions import TypedDict

from typing import Any, Callable, List, Literal, Optional, Sequence, TypeVar, Union

from dlt.common.typing import TSortOrder, TTableHintTemplate, TColumnNames
from dlt.common.typing import TSortOrder, TTableHintTemplate, TColumnNames, TypedDict

TCursorValue = TypeVar("TCursorValue", bound=Any)
LastValueFunc = Callable[[Sequence[TCursorValue]], Any]
Expand Down
2 changes: 1 addition & 1 deletion dlt/common/libs/pydantic.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
Generic,
Optional,
Set,
TypedDict,
List,
Type,
Union,
Expand All @@ -15,6 +14,7 @@
)
from typing_extensions import Annotated, get_args, get_origin

from dlt.common.typing import TypedDict
from dlt.common.data_types import py_type_to_sc_type
from dlt.common.exceptions import MissingDependencyException
from dlt.common.schema import DataValidationError
Expand Down
3 changes: 2 additions & 1 deletion dlt/common/metrics.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import datetime # noqa: I251
from typing import Any, Dict, List, NamedTuple, Optional, Tuple, TypedDict # noqa: 251
from typing import Any, Dict, List, NamedTuple, Optional, Tuple # noqa: 251
from dlt.common.typing import TypedDict


class DataWriterMetrics(NamedTuple):
Expand Down
2 changes: 1 addition & 1 deletion dlt/common/normalizers/json/relational.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
Tuple,
Type,
cast,
TypedDict,
Any,
)

from dlt.common.typing import TypedDict
from dlt.common.normalizers.exceptions import InvalidJsonNormalizer
from dlt.common.normalizers.typing import TJSONNormalizer
from dlt.common.normalizers.utils import generate_dlt_id
Expand Down
4 changes: 2 additions & 2 deletions dlt/common/normalizers/typing.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import List, Optional, Type, TypedDict, Literal, Union
from typing import List, Optional, Type, Literal, Union
from types import ModuleType

from dlt.common.typing import StrAny
from dlt.common.typing import StrAny, TypedDict
from dlt.common.normalizers.naming import NamingConvention

TNamingConventionReferenceArg = Union[str, Type[NamingConvention], ModuleType]
Expand Down
2 changes: 1 addition & 1 deletion dlt/common/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
Sequence,
Tuple,
TypeVar,
TypedDict,
Mapping,
Literal,
)
from typing_extensions import NotRequired

from dlt.common.typing import TypedDict
from dlt.common.configuration import configspec
from dlt.common.configuration import known_sections
from dlt.common.configuration.container import Container
Expand Down
3 changes: 1 addition & 2 deletions dlt/common/runtime/typing.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from typing import (
List,
Literal,
TypedDict,
)

from dlt.common.typing import TypedDict

TExecInfoNames = Literal[
"kubernetes",
Expand Down
2 changes: 1 addition & 1 deletion dlt/common/schema/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
Set,
Tuple,
Type,
TypedDict,
NewType,
Union,
get_args,
)
from typing_extensions import Never

from dlt.common.typing import TypedDict
from dlt.common.data_types import TDataType
from dlt.common.normalizers.typing import TNormalizersConfig
from dlt.common.typing import TSortOrder, TAnyDateTime, TLoaderFileFormat, TColumnNames
Expand Down
2 changes: 1 addition & 1 deletion dlt/common/storages/fsspec_filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
Literal,
cast,
Tuple,
TypedDict,
Optional,
Union,
Iterator,
Expand All @@ -25,6 +24,7 @@
from fsspec.core import url_to_fs

from dlt import version
from dlt.common.typing import TypedDict
from dlt.common.pendulum import pendulum
from dlt.common.configuration.specs import (
GcpCredentials,
Expand Down
2 changes: 1 addition & 1 deletion dlt/common/storages/load_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
cast,
Any,
Tuple,
TypedDict,
)
from typing_extensions import NotRequired

from dlt.common.typing import TypedDict
from dlt.common.pendulum import pendulum
from dlt.common.json import json
from dlt.common.configuration import configspec
Expand Down
2 changes: 2 additions & 0 deletions dlt/common/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@

from typing_extensions import is_typeddict as _is_typeddict

from typing_extensions import TypedDict # noqa: I251

try:
from types import UnionType # type: ignore[attr-defined]
except ImportError:
Expand Down
3 changes: 2 additions & 1 deletion dlt/common/versioned_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
import hashlib
import binascii
from copy import copy
from typing import TypedDict, List, Tuple, Mapping
from typing import List, Tuple, Mapping

from dlt.common.json import json
from dlt.common.typing import DictStrAny
from dlt.common.utils import compressed_b64decode, compressed_b64encode
from dlt.common.typing import TypedDict


class TVersionedState(TypedDict, total=False):
Expand Down
3 changes: 1 addition & 2 deletions dlt/destinations/sql_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@
AnyStr,
List,
Generator,
TypedDict,
cast,
)

from dlt.common.typing import TFun
from dlt.common.typing import TFun, TypedDict
from dlt.common.schema.typing import TTableSchemaColumns
from dlt.common.destination import DestinationCapabilitiesContext
from dlt.common.utils import concat_strings_with_limit
Expand Down
3 changes: 2 additions & 1 deletion dlt/destinations/sql_jobs.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from typing import Any, Dict, List, Sequence, Tuple, cast, TypedDict, Optional, Callable, Union
from typing import Any, Dict, List, Sequence, Tuple, cast, Optional, Callable, Union

import yaml
from dlt.common.time import ensure_pendulum_datetime
from dlt.common.destination.reference import PreparedTableSchema
from dlt.common.destination.utils import resolve_merge_strategy
from dlt.common.typing import TypedDict

from dlt.common.schema.typing import (
TSortOrder,
Expand Down
Loading

0 comments on commit c7c3370

Please sign in to comment.