diff --git a/.bumpversion.cfg b/.bumpversion.cfg index ae700ec..d2fcdb6 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.0.1 +current_version = 0.1.0 commit = False tag = False parse = (?P\d+)\.(?P\d+)\.(?P\d+)((\-rc)(?P\d+))? diff --git a/.github/workflows/run-linting-tests.yml b/.github/workflows/run-linting-tests.yml index 46409b8..e5d5c63 100644 --- a/.github/workflows/run-linting-tests.yml +++ b/.github/workflows/run-linting-tests.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.10'] + python-version: ['3.9', '3.10', '3.11'] fail-fast: false steps: @@ -37,6 +37,6 @@ jobs: run: | # stop the build if there are Python syntax errors or undefined names flake8 . -# - name: Check with mypy -# run: | -# mypy . + - name: Check with mypy + run: | + mypy pydantic_forms diff --git a/.github/workflows/run-unit-tests.yml b/.github/workflows/run-unit-tests.yml index ca0664e..fc1d197 100644 --- a/.github/workflows/run-unit-tests.yml +++ b/.github/workflows/run-unit-tests.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.8', '3.9', '3.10'] + python-version: ['3.9', '3.10', '3.11'] fail-fast: false container: python:${{ matrix.python-version }}-slim steps: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ece063f..1400c34 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,7 +7,7 @@ repos: rev: 23.1.0 hooks: - id: black - language_version: python3.10 + language_version: python3.9 - repo: https://github.com/asottile/blacken-docs rev: 1.13.0 hooks: @@ -44,7 +44,7 @@ repos: rev: v1.0.1 hooks: - id: mypy - language_version: python3.10 + language_version: python3.9 additional_dependencies: - pydantic - types-toml diff --git a/pydantic_forms/__init__.py b/pydantic_forms/__init__.py index d5c907c..5f486f1 100644 --- a/pydantic_forms/__init__.py +++ b/pydantic_forms/__init__.py @@ -13,4 +13,4 @@ """This is the pydantic-forms engine.""" -__version__ = "0.0.1" +__version__ = "0.1.0" diff --git a/pydantic_forms/core/asynchronous.py b/pydantic_forms/core/asynchronous.py index e0be6fb..cef7a51 100644 --- a/pydantic_forms/core/asynchronous.py +++ b/pydantic_forms/core/asynchronous.py @@ -56,7 +56,7 @@ async def post_form( # Generate first form (we need to send None here, since the arguments are already given # when we initialized the generator) - generated_form: InputForm | dict = await generator.asend(None) + generated_form: Union[InputForm, dict] = await generator.asend(None) # Loop through user inputs and for each input validate and update current state and validation results user_inputs = user_inputs.copy() diff --git a/pydantic_forms/types.py b/pydantic_forms/types.py index 05d9c1c..8bb74a5 100644 --- a/pydantic_forms/types.py +++ b/pydantic_forms/types.py @@ -3,7 +3,7 @@ try: # python3.10 introduces types.UnionType for the new union and optional type defs. - from types import UnionType + from types import UnionType # type: ignore # 3.9 compatibility union_types = [Union, UnionType] except ImportError: @@ -58,5 +58,5 @@ class SummaryData(TypedDict, total=False): StateInputStepFunc = Union[StateSimpleInputFormGenerator, StateInputFormGenerator] SubscriptionMapping = Dict[str, List[Dict[str, str]]] -FormGeneratorAsync = AsyncGenerator[Type[T] | State, T] # [YieldType, SendType] +FormGeneratorAsync = AsyncGenerator[Union[Type[T], State], T] # [YieldType, SendType] StateInputFormGeneratorAsync = Callable[[State], FormGeneratorAsync] diff --git a/pyproject.toml b/pyproject.toml index 3fc0393..dc41355 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,13 +23,15 @@ classifiers = [ "Development Status :: 3 - Alpha", "Environment :: Web Environment", "Framework :: AsyncIO", + "Framework :: FastAPI", + "Framework :: Flask", "Intended Audience :: Developers", "Intended Audience :: Telecommunications Industry", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Topic :: Internet :: WWW/HTTP :: HTTP Servers", "Topic :: Internet :: WWW/HTTP", ] @@ -38,7 +40,7 @@ requires = [ ] description-file = "README.md" -requires-python = ">=3.7,<3.11" +requires-python = ">=3.9,<=3.11" [tool.flit.metadata.urls] Documentation = "https://github.com/workfloworchestrator/pydantic-forms/blob/main/README.md" diff --git a/setup.cfg b/setup.cfg index 9766b1b..95c8346 100644 --- a/setup.cfg +++ b/setup.cfg @@ -36,7 +36,8 @@ disallow_untyped_decorators = True no_implicit_optional = True strict_optional = True namespace_packages = true -warn_unused_ignores = True +; TODO re-enable unused ignores when we stop supporting 3.9 https://github.com/python/mypy/issues/8823 +warn_unused_ignores = False warn_redundant_casts = True ; Disable due to flaky results in mypy itself ;warn_return_any = True