diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 78690e1..b4fc62d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -69,10 +69,10 @@ jobs: # set health checks to wait until Oracle has started options: >- --health-cmd healthcheck.sh - --health-interval 10s - --health-timeout 5s - --health-retries 5 - --health-start-period 10s + --health-interval 20s + --health-timeout 10s + --health-retries 10 + --health-start-period 30s strategy: matrix: @@ -172,6 +172,9 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Install Microsoft ODBC + run: sudo ACCEPT_EULA=Y apt-get install msodbcsql18 -y + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: diff --git a/LICENSE b/LICENSE index 51af19b..5d2d004 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 Levente Hunyadi +Copyright (c) 2023-2024 Levente Hunyadi Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/pysqlsync/__init__.py b/pysqlsync/__init__.py index cf2b651..ee63321 100644 --- a/pysqlsync/__init__.py +++ b/pysqlsync/__init__.py @@ -9,7 +9,7 @@ __version__ = "0.3.0" __author__ = "Levente Hunyadi" -__copyright__ = "Copyright 2023, Levente Hunyadi" +__copyright__ = "Copyright 2023-2024, Levente Hunyadi" __license__ = "MIT" __maintainer__ = "Levente Hunyadi" __status__ = "Production" diff --git a/pysqlsync/formation/sql_to_py.py b/pysqlsync/formation/sql_to_py.py index 8ed918b..a924f5a 100644 --- a/pysqlsync/formation/sql_to_py.py +++ b/pysqlsync/formation/sql_to_py.py @@ -4,6 +4,7 @@ import keyword import sys import types +import typing from dataclasses import dataclass from io import StringIO from typing import Annotated, Any, Optional, Union @@ -122,7 +123,7 @@ def qual_to_module(self, id: SupportsQualifiedId) -> str: def column_to_field( self, table: Table, column: Column - ) -> tuple[str, TypeLike, dataclasses.Field]: + ) -> tuple[str, type, dataclasses.Field]: """ Generates a dataclass field corresponding to a table column. @@ -154,11 +155,10 @@ def column_to_field( union_types = tuple(self.qual_to_module(r.table) for r in c.references) field_type = Union[union_types] - return ( - field_name, - field_type, - dataclasses.field(default=default), - ) + # use cast to ensure compatibility with signature of `make_dataclass` + data_type = typing.cast(type, field_type) + + return (field_name, data_type, dataclasses.field(default=default)) def table_to_dataclass(self, table: Table) -> type[DataclassInstance]: """ @@ -183,7 +183,7 @@ def table_to_dataclass(self, table: Table) -> type[DataclassInstance]: typ = dataclasses.make_dataclass(class_name, fields, module=module.__name__) else: typ = dataclasses.make_dataclass( - class_name, fields, namespace={"__module__": module.__name__} # type: ignore + class_name, fields, namespace={"__module__": module.__name__} ) with StringIO() as out: for field in dataclasses.fields(typ): diff --git a/requirements.txt b/requirements.txt index 428bda6..a1b14a4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,10 +1,11 @@ # core -json_strong_typing >= 0.3.1 +json_strong_typing >= 0.3.2 typing_extensions >= 4.8; python_version<"3.12" # development tools -mypy -flake8 +build >= 1.0 +mypy >= 1.8 +flake8 >= 7.0 # data export/import tsv2py >= 0.5.2 diff --git a/setup.cfg b/setup.cfg index 3919a2d..f708d92 100644 --- a/setup.cfg +++ b/setup.cfg @@ -29,7 +29,7 @@ include_package_data = True packages = find: python_requires = >=3.9 install_requires = - json_strong_typing >= 0.3.1 + json_strong_typing >= 0.3.2 typing_extensions >= 4.8; python_version<"3.12" [options.extras_require]