From b85fe394a8a55deda0a2cb98a1a0e83a3db769b0 Mon Sep 17 00:00:00 2001 From: Marius Gedminas Date: Tue, 3 Oct 2023 12:57:15 +0300 Subject: [PATCH 1/3] Support Python 3.12 --- .github/workflows/build.yml | 1 + CHANGES.rst | 7 +++++-- appveyor.yml | 1 + setup.py | 1 + src/check_python_versions/__init__.py | 2 +- src/check_python_versions/versions.py | 2 +- tox.ini | 2 +- 7 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 87d929f..8810133 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,6 +24,7 @@ jobs: - "3.9" - "3.10" - "3.11" + - "3.12" - "pypy-3.10" steps: diff --git a/CHANGES.rst b/CHANGES.rst index 10fb6c2..fe69c85 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,9 +1,12 @@ Changelog ========= -0.21.4 (unreleased) +0.22.0 (unreleased) ------------------- +- Add support for Python 3.12: treat it as a released version, run CI tests on + 3.12. + - Drop support for Python 3.7. @@ -43,7 +46,7 @@ Changelog 0.20.0 (2022-10-27) ------------------- -- Add support for Python 3.11: threat it as a released version, run CI tests on +- Add support for Python 3.11: treat it as a released version, run CI tests on 3.11. diff --git a/appveyor.yml b/appveyor.yml index 6d1d6ea..9e92fc2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,6 +8,7 @@ environment: - PYTHON: "C:\\Python39" - PYTHON: "C:\\Python310" - PYTHON: "C:\\Python311" + - PYTHON: "C:\\Python312" init: - "echo %PYTHON%" diff --git a/setup.py b/setup.py index 117eb34..7da28a8 100755 --- a/setup.py +++ b/setup.py @@ -55,6 +55,7 @@ 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', ], diff --git a/src/check_python_versions/__init__.py b/src/check_python_versions/__init__.py index b7fb17d..d29af37 100644 --- a/src/check_python_versions/__init__.py +++ b/src/check_python_versions/__init__.py @@ -13,4 +13,4 @@ """ __author__ = 'Marius Gedminas ' -__version__ = '0.21.4.dev0' +__version__ = '0.22.0.dev0' diff --git a/src/check_python_versions/versions.py b/src/check_python_versions/versions.py index 0aff51c..5b7b3c7 100644 --- a/src/check_python_versions/versions.py +++ b/src/check_python_versions/versions.py @@ -11,7 +11,7 @@ MAX_PYTHON_1_VERSION = 6 # i.e. 1.6 MAX_PYTHON_2_VERSION = 7 # i.e. 2.7 -CURRENT_PYTHON_3_VERSION = 11 # i.e. 3.10 +CURRENT_PYTHON_3_VERSION = 12 # i.e. 3.12 MAX_MINOR_FOR_MAJOR = { 1: MAX_PYTHON_1_VERSION, diff --git a/tox.ini b/tox.ini index 5ae44b9..ed94beb 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py38,py39,py310,py311,pypy3,flake8,mypy,isort,coverage +envlist = py38,py39,py310,py311,py312,pypy3,flake8,mypy,isort,coverage [testenv] deps = From 0554c1da12064d5cb68188a783bee964b468dc12 Mon Sep 17 00:00:00 2001 From: Marius Gedminas Date: Wed, 4 Oct 2023 11:33:35 +0300 Subject: [PATCH 2/3] Install setuptools globally on Appveyor Our test suite expects 'python' in %PATH% to have setuptools available. --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index 9e92fc2..f9e35b1 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -23,6 +23,7 @@ install: - "set PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" - python --version - pip install -U virtualenv # upgrade pip in tox's virtualenvs + - pip install setuptools # the test suite needs the system python to have setuptools - pip install tox build: off From 7133020bcdaa6effb495e3eaf09ca0cdb47aa926 Mon Sep 17 00:00:00 2001 From: Marius Gedminas Date: Wed, 4 Oct 2023 11:42:44 +0300 Subject: [PATCH 3/3] Use coveralls github action Because the command-line coveralls tool pins coverage < 7.0, which doesn't work well on Python 3.12. Also update all the GitHub actions to the latest versions and tweak YAML formatting so all the shell commands are aligned. --- .github/workflows/build.yml | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8810133..4522f1a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,15 +29,15 @@ jobs: steps: - name: Git clone - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: "${{ matrix.python-version }}" - name: Pip cache - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.py') }} @@ -49,23 +49,24 @@ jobs: run: | python -m pip install -U pip python -m pip install -U setuptools wheel - python -m pip install -U pytest coverage coveralls + python -m pip install -U pytest coverage python -m pip install -e . - name: Run tests - run: coverage run -m pytest tests + run: | + coverage run -m pytest tests - name: Check test coverage - run: coverage report -m --fail-under=${{ (matrix.python-version == 'pypy-3.10') && 99 || 100 }} + run: | + coverage report -m --fail-under=${{ (matrix.python-version == 'pypy-3.10') && 99 || 100 }} + coverage xml # pypy3.10 thinks utils.py has one uncovered branch (140 -> 133), which # I think is just pypy's optimizer being too smart for coverage.py. - name: Report to coveralls - run: coveralls - continue-on-error: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - COVERALLS_SERVICE_NAME: github + uses: coverallsapp/github-action@v2 + with: + file: coverage.xml lint: name: ${{ matrix.toxenv }} @@ -82,15 +83,15 @@ jobs: steps: - name: Git clone - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Python ${{ env.default_python || '3.9' }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: "${{ env.default_python || '3.9' }}" - name: Pip cache - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ matrix.toxenv }}-${{ hashFiles('tox.ini') }} @@ -105,4 +106,5 @@ jobs: python -m pip install -U tox - name: Run ${{ matrix.toxenv }} - run: python -m tox -e ${{ matrix.toxenv }} + run: | + python -m tox -e ${{ matrix.toxenv }}