Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 61 additions & 75 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,137 +20,123 @@ jobs:
fail-fast: false
matrix:
py:
- "pypy3.11" # ahead to start it earlier because takes longer
- "pypy3.11"
- "3.14"
- "3.13"
- "3.12"
- "3.11"
- "3.10"
os:
- ubuntu-latest
- windows-latest
- macos-latest
- ubuntu-24.04
- windows-2025
- macos-15
exclude:
- { os: windows-2025, py: pypy3.11 }

steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Add .local/bin to Windows PATH
if: runner.os == 'Windows'
shell: bash
run: echo "$USERPROFILE/.local/bin" >> $GITHUB_PATH
- name: install hatch
run: uv tool install --python-preference only-managed --python 3.13 hatch
- name: install Python
- name: Install tox
run: uv tool install --python-preference only-managed --python 3.14 tox --with tox-uv
- name: Install Python
run: uv python install --python-preference only-managed ${{ matrix.py }}
- name: Pick environment to run
run: |
import codecs; import os
py = "${{ matrix.py }}"
py = "test.{}".format(py if py.startswith("pypy") else f"py{py}")
print(f"Picked {py}")
with codecs.open(os.environ["GITHUB_ENV"], mode="a", encoding="utf-8") as file_handler:
file_handler.write(f"FORCE_COLOR=1\nENV={py}\n")
shell: python
- name: Setup test environment
- name: Setup test suite
run: tox run -vv --notest --skip-missing-interpreters false -e ${{ matrix.py }}
env:
UV_PYTHON_PREFERENCE: only-managed
- name: Run test suite
run: |
hatch -v env create ${ENV}
hatch run ${ENV}:uv pip tree
if [[ "${{ matrix.py }}" == pypy* ]]; then
tox run --skip-pkg-install -e ${{ matrix.py }} --
else
tox run --skip-pkg-install -e ${{ matrix.py }}
fi
shell: bash
- name: Run test suite
run: hatch -v run ${ENV}:run
env:
PYTEST_ADDOPTS: "-vv --durations=20"
CI_RUN: "yes"
shell: bash
UV_PYTHON_PREFERENCE: only-managed
DIFF_AGAINST: HEAD
- name: Rename coverage report file
if: ${{ !startsWith(matrix.py, 'pypy')}}
run: |
import os; import sys;
os.rename(f"report{os.sep}.coverage.${{ matrix.py }}", f"report{os.sep}.coverage.${{ matrix.py }}-{sys.platform}")
import os; import sys
os.rename(f".tox/.coverage.${{ matrix.py }}", f".tox/.coverage.${{ matrix.py }}-{sys.platform}")
shell: python
- name: Upload coverage data
if: ${{ !startsWith(matrix.py, 'pypy')}}
uses: actions/upload-artifact@v6
with:
include-hidden-files: true
name: coverage-${{ matrix.os }}-${{ matrix.py }}
path: "report/.coverage.*"
name: .coverage.${{ matrix.os }}.${{ matrix.py }}
path: ".tox/.coverage.*"
retention-days: 3

coverage:
name: Combine coverage
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs: test
steps:
- name: Let us have colors
run: echo "FORCE_COLOR=true" >> "$GITHUB_ENV"
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: install hatch
run: uv tool install --python-preference only-managed --python 3.13 hatch
- name: Install tox
run: uv tool install --python-preference only-managed --python 3.14 tox --with tox-uv
- name: Build package to generate version
run: uv build --python 3.14 --python-preference only-managed --wheel . --out-dir dist
- name: Setup coverage tool
run: |
hatch -v env create coverage
hatch run coverage:pip freeze
run: tox -e coverage --notest
env:
UV_PYTHON_PREFERENCE: only-managed
- name: Download coverage data
uses: actions/download-artifact@v7
with:
path: report
pattern: coverage-*
path: .tox
pattern: .coverage.*
merge-multiple: true
- name: Combine and report coverage
run: hatch run coverage:run
run: tox -e coverage --skip-pkg-install
env:
UV_PYTHON_PREFERENCE: only-managed
- name: Upload HTML report
uses: actions/upload-artifact@v6
with:
name: html-report
path: report/html
path: .tox/htmlcov

check:
name: ${{ matrix.env.name }} - ${{ matrix.os }}
name: ${{ matrix.tox_env }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
env:
- { "name": "default", "target": "show" }
- { "name": "type", "target": "run" }
- { "name": "docs", "target": "build" }
- { "name": "readme", "target": "run" }
- ubuntu-24.04
- windows-2025
tox_env:
- dev
- type
- docs
- pkg_meta
exclude:
- { os: windows-2025, tox_env: pkg_meta }
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Add .local/bin to Windows PATH
if: runner.os == 'Windows'
shell: bash
run: echo "$USERPROFILE/.local/bin" >> $GITHUB_PATH
- name: install hatch
run: uv tool install --python-preference only-managed --python 3.13 hatch
- name: Setup ${{ matrix.env.name }}
run: |
hatch -v env create ${{ matrix.env.name }}
hatch run ${{ matrix.env.name }}:pip freeze
- name: Run ${{ matrix.env.name }}
run: hatch -v run ${{ matrix.env.name }}:${{ matrix.env.target }}
- name: Install tox
run: uv tool install --python-preference only-managed --python 3.14 tox --with tox-uv
- name: Setup test suite
run: tox run -vv --notest --skip-missing-interpreters false -e ${{ matrix.tox_env }}
env:
UV_PYTHON_PREFERENCE: only-managed
- name: Run test suite
run: tox run --skip-pkg-install -e ${{ matrix.tox_env }}
env:
UV_PYTHON_PREFERENCE: only-managed
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
cache-dependency-glob: "pyproject.toml"
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build package
run: uv build --python 3.13 --python-preference only-managed --sdist --wheel . --out-dir dist
run: uv build --python 3.14 --python-preference only-managed --sdist --wheel . --out-dir dist
- name: Store the distribution packages
uses: actions/upload-artifact@v6
with:
Expand Down
12 changes: 8 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,20 @@ repos:
rev: v2.4.1
hooks:
- id: codespell
additional_dependencies: ["tomli>=2.2.1"]
additional_dependencies: ["tomli>=2.4"]
- repo: https://github.com/tox-dev/tox-toml-fmt
rev: "v1.5.4"
hooks:
- id: tox-toml-fmt
- repo: https://github.com/tox-dev/pyproject-fmt
rev: "v2.12.1"
rev: "v2.15.3"
hooks:
- id: pyproject-fmt
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.14.14"
rev: "v0.15.0"
hooks:
- id: ruff-format
- id: ruff
- id: ruff-check
args: ["--fix", "--unsafe-fixes", "--exit-non-zero-on-fix"]
- repo: https://github.com/rbubley/mirrors-prettier
rev: "v3.8.1"
Expand Down
17 changes: 6 additions & 11 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
version: 2
build:
os: ubuntu-22.04
os: ubuntu-lts-latest
tools:
python: "3"
python:
install:
- method: pip
path: .
extra_requirements:
- docs
sphinx:
builder: html
configuration: docs/conf.py
fail_on_warning: true
commands:
- pip install uv
- uv venv
- uv pip install tox-uv
- .venv/bin/tox run -e docs --
Loading