diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index f5cf612..638b77f 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -13,8 +13,10 @@ jobs: fail-fast: false matrix: include: - - { name: "3.8", python: "3.8", tox: py38 } - - { name: "3.12", python: "3.12", tox: py312 } + - { name: "3.9", python: "3.9", tox: py39-marshmallow3 } + - { name: "3.13", python: "3.13", tox: py313-marshmallow3 } + - { name: "lowest", python: "3.9", tox: py39-lowest } + - { name: "dev", python: "3.13", tox: py313-marshmallowdev } steps: - uses: actions/checkout@v4.0.0 - uses: actions/setup-python@v4.7.0 @@ -34,7 +36,7 @@ jobs: - uses: actions/checkout@v4.0.0 - uses: actions/setup-python@v4.7.0 with: - python-version: "3.11" + python-version: "3.13" - run: python -m pip install --upgrade pip - run: python -m pip install tox - run: python -m tox -e lint diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d129547..c8d23fc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,7 +14,7 @@ repos: rev: 1.19.1 hooks: - id: blacken-docs - additional_dependencies: [black==23.12.1] + additional_dependencies: [black==24.10.0] - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.14.1 hooks: diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e3e65fe..c4ab889 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,14 @@ Changelog --------- +3.2.0 (unreleased) +****************** + +Support: + +- Support Python 3.9-3.13. +- Support marshmallow 3-4. + 3.1.1 (2024-02-13) ++++++++++++++++++ diff --git a/README.rst b/README.rst index 3f5247f..bc09dfa 100644 --- a/README.rst +++ b/README.rst @@ -12,9 +12,9 @@ marshmallow-oneofschema :target: https://github.com/marshmallow-code/flask-marshmallow/actions/workflows/build-release.yml :alt: Build status -.. |marshmallow3| image:: https://badgen.net/badge/marshmallow/3 +.. |marshmallow-support| image:: https://badgen.net/badge/marshmallow/3,4?list=1 :target: https://marshmallow.readthedocs.io/en/latest/upgrading.html - :alt: marshmallow 3 compatible + :alt: marshmallow 3|4 compatible An extension to marshmallow to support schema (de)multiplexing. diff --git a/pyproject.toml b/pyproject.toml index f81be52..e72cb2b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,13 +10,13 @@ classifiers = [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.8" +requires-python = ">=3.9" dependencies = ["marshmallow>=3.0.0,<4.0.0"] [project.urls] @@ -53,3 +53,10 @@ select = [ "UP", # pyupgrade "W", # pycodestyle warning ] + +[tool.mypy] +ignore_missing_imports = true +warn_unreachable = true +warn_unused_ignores = true +warn_redundant_casts = true +no_implicit_optional = true diff --git a/src/marshmallow_oneofschema/one_of_schema.py b/src/marshmallow_oneofschema/one_of_schema.py index 71ea765..464d55b 100644 --- a/src/marshmallow_oneofschema/one_of_schema.py +++ b/src/marshmallow_oneofschema/one_of_schema.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import typing from marshmallow import Schema, ValidationError @@ -59,7 +61,7 @@ def get_obj_type(self, obj): type_field = "type" type_field_remove = True - type_schemas: typing.Mapping[str, typing.Union[typing.Type[Schema], Schema]] = {} + type_schemas: typing.Mapping[str, type[Schema] | Schema] = {} def get_obj_type(self, obj): """Returns name of the schema during dump() calls, given the object diff --git a/tox.ini b/tox.ini index 0e74a88..2574d22 100644 --- a/tox.ini +++ b/tox.ini @@ -1,14 +1,20 @@ [tox] envlist= lint - py{38,39,310,311,312} + py{39,310,311,312,313}-marshmallow3 + py313-marshmallowdev + py39-lowest [testenv] extras = tests +deps = + marshmallow3: marshmallow>=3.0.0,<4.0.0 + marshmallowdev: https://github.com/marshmallow-code/marshmallow/archive/dev.tar.gz + lowest: marshmallow==3.0.0 commands = pytest {posargs} [testenv:lint] -deps = pre-commit~=3.5 +deps = pre-commit~=4.0.1 skip_install = true commands = pre-commit run --all-files