From 7c772c2a2f9e2e9664f315e142ead613d93378bd Mon Sep 17 00:00:00 2001 From: Davide Brunato Date: Fri, 14 Apr 2023 15:08:02 +0200 Subject: [PATCH] Add Python 3.12 support and update static typing checks - Use mypy==1.2.0 for static typing checks - Add py312, mypy-pypy3 and mypy-py312 test environments - py312: skip lxml installation for now --- .github/workflows/test-xmlschema.yml | 4 ++-- tox.ini | 25 ++++++++++++++----------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test-xmlschema.yml b/.github/workflows/test-xmlschema.yml index d97cb342..026b03b3 100644 --- a/.github/workflows/test-xmlschema.yml +++ b/.github/workflows/test-xmlschema.yml @@ -47,10 +47,10 @@ jobs: - name: Lint with mypy if Python version != 3.7 if: ${{ matrix.python-version != '3.7' }} run: | - pip install mypy==1.0.1 elementpath==4.0.1 lxml-stubs + pip install mypy==1.2.0 elementpath==4.1.1 lxml-stubs mypy --show-error-codes --strict xmlschema - name: Lint with mypy if Python version == 3.7 if: ${{ matrix.python-version == '3.7' }} run: | - pip install mypy==1.0.1 elementpath==4.0.1 lxml-stubs + pip install mypy==1.2.0 elementpath==4.1.1 lxml-stubs mypy --show-error-codes --no-warn-redundant-casts --no-warn-unused-ignores --strict xmlschema diff --git a/tox.ini b/tox.ini index e68bf6bd..e1a39498 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] -envlist = py{37,38,39,310,311}, pypy3, ep{40}, docs, - flake8, mypy-py{37,38,39,310,311}, coverage, pytest +envlist = py{37,38,39,310,311,312,py3}, ep{40}, docs, + flake8, mypy-py{37,38,39,310,311,312,py3}, coverage, pytest skip_missing_interpreters = true work_dir = {tox_root}/../.tox/xmlschema @@ -15,10 +15,12 @@ deps = coverage: coverage commands = python -m unittest -allowlist_externals = make -[testenv:pypy3] -commands = python -m unittest +[testenv:py312] +deps = + elementpath>=4.0.0, <5.0.0 + # lxml: skip for now + jinja2 [testenv:ep40] deps = @@ -31,6 +33,7 @@ commands = make -C doc latexpdf SPHINXOPTS="-W -n" make -C doc doctest SPHINXOPTS="-W -n" sphinx-build -W -n -T -b man doc build/sphinx/man +allowlist_externals = make [flake8] max-line-length = 100 @@ -44,17 +47,17 @@ commands = [testenv:mypy-py37] deps = - mypy==1.0.1 - elementpath==4.0.1 + mypy==1.2.0 + elementpath==4.1.1 lxml-stubs jinja2 commands = mypy --config-file {toxinidir}/mypy.ini xmlschema -[testenv:mypy-py{38,39,310,311}] +[testenv:mypy-py{38,39,310,311,312,py3}] deps = - mypy==1.0.1 - elementpath==4.0.1 + mypy==1.2.0 + elementpath==4.1.1 lxml-stubs jinja2 commands = @@ -74,7 +77,7 @@ deps = elementpath>=4.0.0, <5.0.0 lxml jinja2 - mypy==1.0.1 + mypy==1.2.0 lxml-stubs commands = pytest tests -ra