From c7d684b473ad7bdc564bff367ca26f3e543a30f3 Mon Sep 17 00:00:00 2001 From: Jeff Dairiki Date: Sat, 5 Nov 2022 09:24:03 -0700 Subject: [PATCH] Test under Python 3.11, update CI workflow to latest versions of actions (#220) * Test under Python 3.11 * Do not set PYTHONWARNINGS=error during CI pytest That catches, e.g., deprecation warnings from any package (beyond our control). Note that we do configure a pytest warning filter in pyproject.toml which will generate errors for any warnings generated from within our code. * CI: update to actions/checkout@v3, actions/setup-python@v4, actions/cache@v3 * Hack installation of PyYAML on pypy Currently PyYAML fails to build with Cython 3.0.0a, thus it fails to install from sdist using `pip install --pre`. See https://github.com/yaml/pyyaml/issues/601 * Update pre-commit plugin versions to latest --- .github/workflows/python-package.yml | 24 +++++++++++++++--------- .pre-commit-config.yaml | 6 +++--- pyproject.toml | 2 +- setup.py | 2 ++ 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 878b2bc..9463149 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -11,29 +11,35 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python_version: ["3.6", "3.7", "3.8", "3.9", "3.10", "pypy3"] + python_version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "pypy3.9"] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python_version }} - name: set pre-commit cache - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | ~/.cache/pre-commit ~/.cache/pip key: ${{ matrix.python_version }}-${{ hashFiles('.pre-commit-config.yaml') }}-${{ hashFiles('setup.py') }} + + - name: Use latest pip + run: python -m pip install --upgrade pip + - name: Pre-install PyYAML without --pre + if: ${{ startsWith(matrix.python_version, 'pypy') }} + # Temporary workaround: + # PyYAML fails to build with Cython 3.0.0a + # see https://github.com/yaml/pyyaml/issues/601 + run: pip install PyYAML - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install --pre -e '.[dev]' + run: pip install --pre -e '.[dev]' + - name: Pre-commit hooks if: ${{ matrix.python_version != 'pypy3' && matrix.python_version != '3.6' }} run: pre-commit run --all-files - name: Test with pytest run: pytest - env: - PYTHONWARNINGS: error diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6fcdd46..94e7ba5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,11 +1,11 @@ repos: - repo: https://github.com/asottile/pyupgrade - rev: v3.0.0 + rev: v3.2.0 hooks: - id: pyupgrade args: ["--py36-plus"] - repo: https://github.com/python/black - rev: 22.8.0 + rev: 22.10.0 hooks: - id: black language_version: python3 @@ -13,7 +13,7 @@ repos: rev: 5.0.4 hooks: - id: flake8 - additional_dependencies: ['flake8-bugbear==22.9.23'] + additional_dependencies: ['flake8-bugbear==22.10.27'] - repo: https://github.com/pre-commit/mirrors-mypy rev: v0.982 hooks: diff --git a/pyproject.toml b/pyproject.toml index 030f602..4112bd1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.black] line-length = 88 -target-version = ['py36', 'py37', 'py38', 'py39', 'py310'] +target-version = ['py36', 'py37', 'py38', 'py39', 'py310', 'py310'] [tool.pytest.ini_options] filterwarnings = [ diff --git a/setup.py b/setup.py index cafd6e4..ce17610 100644 --- a/setup.py +++ b/setup.py @@ -12,6 +12,8 @@ "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/Libraries", ]