Skip to content

Commit

Permalink
Test under Python 3.11, update CI workflow to latest versions of acti…
Browse files Browse the repository at this point in the history
…ons (#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 yaml/pyyaml#601

* Update pre-commit plugin versions to latest
  • Loading branch information
dairiki committed Nov 5, 2022
1 parent ee7e1cf commit c7d684b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
24 changes: 15 additions & 9 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
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
- repo: https://gitlab.com/pycqa/flake8
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:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 = [
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]

Expand Down

0 comments on commit c7d684b

Please sign in to comment.