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
18 changes: 18 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 2025
# adapt super() calls to Python 3
97c43eb36fa04c8dde2bb5acacdb00782697ad86
# clean up from Python 3 transition: class XYZ(object) -> class XYZ
142d3d9226228e8fc9cac73013990b1ff41d9782
# remove u'' string prefixes
d41faf0bdf0ba5e899625c0f2fd2421aaad8ff1c
# style
94309b91a070d0f64755fe0a7c83e9908b5de42e

# Reformat the codebase
2bb508ef08a0acfd0c8f8b6f8b48a240d2309740
# Fix linting issues
23bcec4bcabe3f1718b90e89d85cfa53d36a4445
# Format docs
424a17ceeccf93d92cb2e6b4062907af858854b1
# Update URLs in the docs
8aa6d237ac6479971ffe38608b2526ef0abe55f4
16 changes: 16 additions & 0 deletions .github/problem-matchers/sphinx-build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"problemMatcher": [
{
"owner": "sphinx-build",
"severity": "error",
"pattern": [
{
"regexp": "^(/[^:]+):((\\d+):)?(\\sWARNING:)?\\s*(.+)$",
"file": 1,
"line": 3,
"message": 5
}
]
}
]
}
17 changes: 17 additions & 0 deletions .github/problem-matchers/sphinx-lint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"problemMatcher": [
{
"owner": "sphinx-lint",
"severity": "error",
"pattern": [
{
"regexp": "^([^:]+):(\\d+):\\s+(.*)\\s\\(([a-z-]+)\\)$",
"file": 1,
"line": 2,
"message": 3,
"code": 4
}
]
}
]
}
8 changes: 4 additions & 4 deletions .github/workflows/changelog_reminder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@ jobs:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6

- name: Get all updated Python files
id: changed-python-files
uses: tj-actions/changed-files@v46
uses: tj-actions/changed-files@v47
with:
files: |
**.py

- name: Check for the changelog update
id: changelog-update
uses: tj-actions/changed-files@v46
uses: tj-actions/changed-files@v47
with:
files: docs/changelog.rst

- name: Comment under the PR with a reminder
if: steps.changed-python-files.outputs.any_changed == 'true' && steps.changelog-update.outputs.any_changed == 'false'
uses: thollander/actions-comment-pull-request@v2
uses: thollander/actions-comment-pull-request@v3
with:
message: 'Thank you for the PR! The changelog has not been updated, so here is a friendly reminder to check if you need to add an entry.'
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
146 changes: 146 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
name: Lint check
run-name: Lint code
on:
pull_request:
push:
branches:
- master

concurrency:
# Cancel previous workflow run when a new commit is pushed to a feature branch
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

env:
PYTHON_VERSION: "3.10"

jobs:
changed-files:
runs-on: ubuntu-latest
name: Get changed files
outputs:
any_docs_changed: ${{ steps.changed-doc-files.outputs.any_changed }}
any_python_changed: ${{ steps.raw-changed-python-files.outputs.any_changed }}
changed_doc_files: ${{ steps.changed-doc-files.outputs.all_changed_files }}
changed_python_files: ${{ steps.changed-python-files.outputs.all_changed_files }}
steps:
- uses: actions/checkout@v6
- name: Get changed docs files
id: changed-doc-files
uses: tj-actions/changed-files@v47
with:
files: |
docs/**
- name: Get changed python files
id: raw-changed-python-files
uses: tj-actions/changed-files@v47
with:
files: |
**.py
poetry.lock

- name: Check changed python files
id: changed-python-files
env:
CHANGED_PYTHON_FILES: ${{ steps.raw-changed-python-files.outputs.all_changed_files }}
run: |
if [[ " $CHANGED_PYTHON_FILES " == *" poetry.lock "* ]]; then
# if poetry.lock is changed, we need to check everything
CHANGED_PYTHON_FILES="."
fi
echo "all_changed_files=$CHANGED_PYTHON_FILES" >> "$GITHUB_OUTPUT"

format:
if: needs.changed-files.outputs.any_python_changed == 'true'
runs-on: ubuntu-latest
name: Check formatting
needs: changed-files
steps:
- uses: actions/checkout@v6
- name: Install Python tools
uses: BrandonLWhite/pipx-install-action@v1.0.3
- uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: poetry

- name: Install dependencies
run: poetry install

- name: Check code formatting
# the job output will contain colored diffs with what needs adjusting
run: poe check-format --output-format=github ${{ needs.changed-files.outputs.changed_python_files }}

lint:
if: needs.changed-files.outputs.any_python_changed == 'true'
runs-on: ubuntu-latest
name: Check linting
needs: changed-files
steps:
- uses: actions/checkout@v6
- name: Install Python tools
uses: BrandonLWhite/pipx-install-action@v1.0.3
- uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: poetry

- name: Install dependencies
run: poetry install

- name: Lint code
run: poe lint --output-format=github ${{ needs.changed-files.outputs.changed_python_files }}

mypy:
if: needs.changed-files.outputs.any_python_changed == 'true'
runs-on: ubuntu-latest
name: Check types with mypy
needs: changed-files
steps:
- uses: actions/checkout@v6
- name: Install Python tools
uses: BrandonLWhite/pipx-install-action@v1.0.3
- uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: poetry

- name: Install dependencies
run: poetry install

- name: Type check code
uses: liskin/gh-problem-matcher-wrap@v3
with:
linters: mypy
run: poe check-types --show-column-numbers --no-error-summary .

docs:
if: needs.changed-files.outputs.any_docs_changed == 'true'
runs-on: ubuntu-latest
name: Check docs
needs: changed-files
steps:
- uses: actions/checkout@v6
- name: Install Python tools
uses: BrandonLWhite/pipx-install-action@v1.0.3
- uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: poetry

- name: Install dependencies
run: poetry install --extras=docs

- name: Add Sphinx problem matchers
run: |
echo "::add-matcher::.github/problem-matchers/sphinx-build.json"
echo "::add-matcher::.github/problem-matchers/sphinx-lint.json"

- name: Check docs formatting
run: poe format-docs --check

- name: Lint docs
run: poe lint-docs

- name: Build docs
run: poe docs -- -e 'SPHINXOPTS=--fail-on-warning --keep-going'
36 changes: 27 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,45 @@
name: Python Tests

on: [push]

name: Test
on:
pull_request:
push:
branches:
- main

jobs:
test:
name: Run tests
runs-on: ubuntu-latest
permissions:
id-token: write
strategy:
fail-fast: false
matrix:
python: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
platform: [ubuntu-latest, windows-latest]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Install Python tools
uses: BrandonLWhite/pipx-install-action@v1.0.3
- name: Setup Python with poetry caching
# poetry cache requires poetry to already be installed, weirdly
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: poetry

- name: Test
run: |-
poetry install
poe test
poe test-with-coverage

- name: Upload test results to Codecov
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}

- name: Upload code coverage
uses: codecov/codecov-action@v5
with:
files: ./coverage.xml
flags: ${{ matrix.platform}}_python${{ matrix.python-version }}
use_oidc: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork) }}
14 changes: 7 additions & 7 deletions .github/workflows/make_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
required: true

env:
PYTHON_VERSION: 3.9
PYTHON_VERSION: 3.10
NEW_VERSION: ${{ inputs.version }}
NEW_TAG: v${{ inputs.version }}

Expand All @@ -17,10 +17,10 @@ jobs:
name: Bump version, commit and create tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Install Python tools
uses: BrandonLWhite/pipx-install-action@v1.0.3
- uses: actions/setup-python@v5
- uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: poetry
Expand All @@ -40,13 +40,13 @@ jobs:
runs-on: ubuntu-latest
needs: increment-version
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
ref: ${{ env.NEW_TAG }}

- name: Install Python tools
uses: BrandonLWhite/pipx-install-action@v1.0.3
- uses: actions/setup-python@v5
- uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: poetry
Expand All @@ -55,7 +55,7 @@ jobs:
run: poetry build

- name: Store the package
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: python-package-distributions
path: dist/
Expand All @@ -71,7 +71,7 @@ jobs:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
uses: actions/download-artifact@v7
with:
name: python-package-distributions
path: dist/
Expand Down
Loading
Loading