From 57151cac657fd9040b20e211fcbf3d3f0f54b80b Mon Sep 17 00:00:00 2001 From: isra17 Date: Fri, 11 Nov 2022 13:54:33 -0500 Subject: [PATCH] Add support to python 3.10 and 3.11 --- .github/workflows/ci.yml | 56 +++++++++++++++++++++++++++++++------ changelog.d/238.changes.rst | 1 + src/desert/_make.py | 2 +- tox.ini | 6 ++-- 4 files changed, 53 insertions(+), 12 deletions(-) create mode 100644 changelog.d/238.changes.rst diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5ab5ba7..6e47bf3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,22 +10,59 @@ on: jobs: ci: - runs-on: ${{ matrix.os }} - container: docker://altendky/hydra:ubuntu-20.04-3-minors + runs-on: ubuntu-latest strategy: fail-fast: false matrix: - os: - - ubuntu-latest + python: + - version: "3.7" + bin: python3.7 + tox: py37,report,codecov + - version: "3.8" + bin: python3.8 + tox: py38,report,codecov + - version: "3.9" + bin: python3.9 + tox: py39,report,codecov + - version: "3.10" + bin: python3.10 + tox: py310,report,codecov + - version: "3.11" + bin: python3.11 + tox: py311,report,codecov + - version: pypy-3.7 + bin: pypy3 + tox: pypy3,report,codecov + env: + TOXTOOLPYTHON: "${{ matrix.python.bin }}" + steps: + - uses: actions/checkout@v3 + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python.version }} + - name: Install + run: | + pip install tox + - name: Test + run: | + tox -v -e "${{ matrix.python.tox }}" + linting: + name: Linting + runs-on: ubuntu-latest + strategy: + matrix: + python: ["3.10"] toxenv: - - py37,report,codecov - - py38,report,codecov - - py39,report,codecov - - pypy3,report,codecov - doc - check steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + architecture: x64 - name: Install run: | pip install tox @@ -37,6 +74,7 @@ jobs: runs-on: ubuntu-latest needs: - ci + - linting steps: - name: This shell: python diff --git a/changelog.d/238.changes.rst b/changelog.d/238.changes.rst new file mode 100644 index 0000000..f239ee8 --- /dev/null +++ b/changelog.d/238.changes.rst @@ -0,0 +1 @@ +Add support to Python 3.10 and 3.11. diff --git a/src/desert/_make.py b/src/desert/_make.py index ca37d21..4c4892e 100644 --- a/src/desert/_make.py +++ b/src/desert/_make.py @@ -300,7 +300,7 @@ def field_for_schema( # t.NewType returns a function with a __supertype__ attribute newtype_supertype = getattr(typ, "__supertype__", None) - if newtype_supertype and inspect.isfunction(typ): + if newtype_supertype and typing_inspect.is_new_type(typ): metadata.setdefault("description", typ.__name__) field = field_for_schema(newtype_supertype, default=default) diff --git a/tox.ini b/tox.ini index 8c91f85..8624db6 100644 --- a/tox.ini +++ b/tox.ini @@ -5,7 +5,7 @@ envlist = clean, check, doc, - {py37,py38,py39,pypy3}, + {py37,py38,py39,py310,py311,pypy3}, report [testenv] @@ -14,7 +14,9 @@ basepython = py37: {env:TOXPYTHON:python3.7} py38: {env:TOXPYTHON:python3.8} py39: {env:TOXPYTHON:python3.9} - {doc,spell,bootstrap,clean,check,report,codecov}: {env:TOXTOOLPYTHON:python3.8} + py310: {env:TOXPYTHON:python3.10} + py311: {env:TOXPYTHON:python3.11} + {doc,spell,bootstrap,clean,check,report,codecov}: {env:TOXTOOLPYTHON:python3.10} setenv = PYTHONPATH={toxinidir}/tests PYTHONUNBUFFERED=yes