From 271e58940bdb22f46a8e4b8030d467e51e20b253 Mon Sep 17 00:00:00 2001 From: John Sirois Date: Fri, 5 Jan 2024 16:03:55 -0800 Subject: [PATCH] Add support for Python 3.13. (#8) --- .github/workflows/ci.yml | 69 +++++++++++++++++++++++++++-------- .github/workflows/release.yml | 6 +-- pyproject.toml | 5 ++- tox.ini | 12 ++++-- 4 files changed, 69 insertions(+), 23 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f9cc2a7..63b6524 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,40 +23,79 @@ jobs: tox-env: typecheck steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "${{ matrix.python-version }}" - name: Check ${{ matrix.check-name }} - uses: pantsbuild/actions/run-tox@e63d2d0e3c339bdffbe5e51e7c39550e3bc527bb + uses: pantsbuild/actions/run-tox@b16b9cf47cd566acfe217b1dafc5b452e27e6fd7 with: tox-env: ${{ matrix.tox-env }} + unit-tests-legacy: + name: (${{ matrix.os }}) TOXENV=py${{ matrix.python-version[0] }}${{ matrix.python-version[1] }} + needs: org-check + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - python-version: [2, 7, 18] + os: ubuntu-22.04 + - python-version: [3, 5, 10] + os: ubuntu-22.04 + - python-version: [3, 6, 15] + os: ubuntu-22.04 + - python-version: [2, 7, 18] + os: macos-12 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Python ${{ join(matrix.python-version, '.') }} + id: pyenv + uses: gabrielfalcao/pyenv-action@v18 + with: + default: "${{ join(matrix.python-version, '.') }}" + - name: Run Unit Tests + run: | + alias python="${{ steps.pyenv.outputs.pyenv_root }}/versions/${{ join(matrix.python-version, '.') }}/bin/python" + python -V + python -mensurepip -U + python -mpip install -U tox + python -mtox -epy${{ matrix.python-version[0] }}${{ matrix.python-version[1] }} -- -vvs unit-tests: name: (${{ matrix.os }}) TOXENV=py${{ matrix.python-version[0] }}${{ matrix.python-version[1] }} needs: org-check runs-on: ${{ matrix.os }} strategy: matrix: - python-version: [[2, 7], [3, 7], [3, 8], [3, 9], [3, 10], [3, 11], [3, 12, "0-beta.2"]] - os: [ubuntu-22.04, macos-12] - exclude: - - os: macos-12 + include: + - os: ubuntu-22.04 python-version: [3, 7] - - os: macos-12 + - os: ubuntu-22.04 python-version: [3, 8] - - os: macos-12 + - os: ubuntu-22.04 python-version: [3, 9] - - os: macos-12 + - os: ubuntu-22.04 python-version: [3, 10] + - os: ubuntu-22.04 + python-version: [3, 11] + - os: ubuntu-22.04 + python-version: [3, 12] + - os: ubuntu-22.04 + python-version: [3, 13, "0-alpha.2"] + - os: macos-12 + python-version: [3, 12] + - os: macos-12 + python-version: [3, 13, "0-alpha.2"] steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Python ${{ join(matrix.python-version, '.') }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "${{ join(matrix.python-version, '.') }}" - name: Run Unit Tests - uses: pantsbuild/actions/run-tox@e63d2d0e3c339bdffbe5e51e7c39550e3bc527bb - with: - tox-env: py${{ matrix.python-version[0] }}${{ matrix.python-version[1] }} -- -vvs + run: | + pip install -U pip + pip install -U tox + tox -epy${{ matrix.python-version[0] }}${{ matrix.python-version[1] }} -- -vvs diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 71620a2..597b9af 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -47,15 +47,15 @@ jobs: id-token: write steps: - name: Checkout ${{ needs.determine-tag.outputs.release-tag }} - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ needs.determine-tag.outputs.release-tag }} - name: Setup Python 3.9 - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: 3.9 - name: Package ${{ needs.determine-tag.outputs.release-tag }} - uses: pantsbuild/actions/run-tox@e63d2d0e3c339bdffbe5e51e7c39550e3bc527bb + uses: pantsbuild/actions/run-tox@b16b9cf47cd566acfe217b1dafc5b452e27e6fd7 with: tox-env: package - name: Publish ${{ needs.determine-tag.outputs.release-tag }} diff --git a/pyproject.toml b/pyproject.toml index 76f554b..07ac806 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["flit_core>=2,<3"] +requires = ["flit_core>=2,<4"] build-backend = "flit_core.buildapi" [tool.flit.metadata] @@ -24,9 +24,10 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Topic :: Utilities", ] -requires-python = ">=2.7,<3.13,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*" +requires-python = ">=2.7,<3.14,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*" requires = [ "setuptools; python_version <= '3.5'", "importlib-metadata; python_version == '3.6' or python_version == '3.7'", diff --git a/tox.ini b/tox.ini index 046ff55..aede814 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -minversion = 3.23.0 +minversion = 3.28.0 isolated_build = true skip_missing_interpreters = true @@ -16,11 +16,16 @@ envlist = py310 py311 py312 + py313 [testenv] deps = - pex==2.1.137; python_version < "3.12" - shiv==1.0.3; python_version >= "3.6" + pex==2.1.156; python_version < "3.13" + + # The fix for shiv under Python 3.123 is off for review in https://github.com/linkedin/shiv/pull/249 + shiv==1.0.4; python_version >= "3.6" and python_version < "3.13" + git+https://github.com/jsirois/shiv@0c8b3e83238327e51955d66ba4fee28c4fc7107f#egg=shiv; python_version >= "3.13" + pytest==4.6.11; python_version < "3.6" pytest==6.2.5; python_version >= "3.6" commands = @@ -70,6 +75,7 @@ commands = mypy --python-version 3.10 . mypy --python-version 3.11 . mypy --python-version 3.12 . + mypy --python-version 3.13 . [_flit] basepython = python3