Skip to content
Closed
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
10 changes: 5 additions & 5 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.11
- name: Set up Python 3.13
uses: actions/setup-python@v3
with:
python-version: '3.11'
python-version: '3.13'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install -e '.[dev]'
pip install uv
uv sync
- name: Test Coverage
run: |-
pytest --junitxml=pytest.xml --cov-report=term-missing --cov=src tests/*/test_integration_*.py | tee pytest-coverage.txt
uv run pytest --junitxml=pytest.xml --cov-report=term-missing --cov=src tests/*/test_integration_*.py | tee pytest-coverage.txt
- name: Comment coverage
uses: coroo/pytest-coverage-commentator@v1.0.2
43 changes: 20 additions & 23 deletions .github/workflows/python_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-versions: ['3.8', '3.9', '3.10', '3.11', '3.12']
python-versions: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -26,19 +26,19 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install -e '.[dev]'
pip install uv
uv sync
- name: Test with pytest
run: |
pytest src/*/test_*.py
uv run pytest src tests/*/test_unit_*.py
integration_tests:
runs-on: ubuntu-latest
needs: unit_tests
strategy:
fail-fast: true
matrix:
# no 3.11 as it's covered by the Coverage job.
python-versions: ['3.8', '3.9', '3.10', '3.12']
# no 3.12 as it's covered by the Coverage job.
python-versions: ['3.8', '3.9', '3.10', '3.11', '3.13', '3.14']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -48,18 +48,18 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
pip install -e '.[dev]'
pip install uv
uv sync
- name: Test with pytest
run: |
pytest tests/*/test_integration_*.py
uv run pytest tests/*/test_integration_*.py
system_tests:
needs: integration_tests
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
python-versions: ['3.8', '3.9', '3.10', '3.11', '3.12']
python-versions: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -69,30 +69,27 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
pip install -e '.[dev]'
pip install uv
uv sync
- name: Test with pytest
run: |
pytest tests/*/test_system_*.py
uv run pytest tests/*/test_system_*.py
style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
- name: Set up Python
uses: actions/setup-python@v3
- uses: psf/black@stable
with:
options: --check --verbose
src: ./src
version: ~= 22.0
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install flake8
- name: Lint with flake8
pip install uv
uv sync
- name: Lint with ruff
run: |-
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
uv run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics
uv run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics
108 changes: 77 additions & 31 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exclude: |
repos:
# GENERAL PURPOSE ##################################################################
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: check-added-large-files
args: [--maxkb=500]
Expand All @@ -37,34 +37,49 @@ repos:
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable

# - repo: https://github.com/commitizen-tools/commitizen
# rev: v4.1.0
# hooks:
# - id: commitizen
# Enforce conventional commit messages
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v4.3.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]

# Spellchecking
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
rev: v2.4.1
hooks:
- id: codespell
args: [-w]
exclude: uv.lock

- repo: https://github.com/BenjaminMummery/pre-commit-hooks
rev: v2.6.0
rev: v2.8.0
hooks:
- id: add-copyright
exclude: .github/|README.md
- id: add-msg-issue
- id: update-copyright
- id: sort-file-contents
files: .gitignore

# update the uv lock
- repo: https://github.com/astral-sh/uv-pre-commit
rev: '0.10.0'
hooks:
- id: uv-lock

# Unify dependencies between pre-commit hooks.
- repo: https://github.com/pre-commit/sync-pre-commit-deps
rev: v0.0.3
hooks:
- id: sync-pre-commit-deps

# C++ ###############################################################################
- repo: https://github.com/pocc/pre-commit-hooks
rev: 'v1.3.5'
hooks:
- id: clang-format
args: [-i]
# - id: clang-tidy
# args: [--fix-errors]
- id: cppcheck
- id: cpplint

Expand All @@ -83,58 +98,76 @@ repos:

# PYTHON ###########################################################################
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: check-ast
- id: check-builtin-literals
- id: check-docstring-first
- id: debug-statements
- id: fix-encoding-pragma
args: [--remove]
- id: requirements-txt-fixer

- repo: https://github.com/asottile/pyupgrade
rev: 'v3.21.2'
hooks:
- id: pyupgrade

# Remove unused imports
- repo: https://github.com/hadialqattan/pycln
rev: v2.4.0
rev: v2.6.0
hooks:
- id: pycln
exclude: __init__.py

# Sort imports
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
rev: 7.0.0
hooks:
- id: isort
args: [--profile, black]

# Remove unneeded f-strings
- repo: https://github.com/dannysepler/rm_unneeded_f_str
rev: v0.2.0
hooks:
- id: rm-unneeded-f-str

- repo: https://github.com/psf/black
rev: 24.10.0
hooks:
- id: black

# - repo: https://github.com/PyCQA/flake8
# rev: 7.1.1
# Lint with black
# - repo: https://github.com/psf/black
# rev: 26.1.0
# hooks:
# - id: flake8
# entry: pflake8
# additional_dependencies: [pyproject-flake8]
# - id: black

# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v1.13.0
# hooks:
# - id: mypy
# additional_dependencies: ["types-all"]
# Static type checking
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.19.1
hooks:
- id: mypy

# Detect missing docstrings
- repo: https://github.com/econchick/interrogate # flags up missing docstrings
rev: 1.7.0
hooks:
- id: interrogate
args: [--config=pyproject.toml]
exclude: test_.*\.py|conftest.py

# docstring checking
- repo: https://github.com/pycqa/pydocstyle
rev: 6.3.0
hooks:
- id: pydocstyle
args: [--config=pyproject.toml, --count]
exclude: ^tests/|conftest.py

# Lint and format with ruff
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.15.0'
hooks:
- id: ruff
args: [--config=pyproject.toml]
- id: ruff-format
args: [--config=pyproject.toml]

# - repo: https://github.com/pycqa/pydocstyle
# rev: 6.3.0
# hooks:
Expand All @@ -143,14 +176,27 @@ repos:
# additional_dependencies: [tomli]
# exclude: test_.*\.py|conftest.py

# JUPYTER NOPEBOOKS ################################################################

# remove outputs from jupyter notebooks.
- repo: local
hooks:
- id: jupyter-nb-clear-output
name: jupyter-nb-clear-output
files: \.ipynb$
stages: [pre-commit]
language: system
entry: poetry run jupyter nbconvert --ClearOutputPreprocessor.enabled=True --ClearMetadataPreprocessor.enabled=True --inplace examples/*.ipynb


# YAML #############################################################################
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: check-yaml

- repo: https://github.com/lyz-code/yamlfix
rev: 1.17.0
rev: 1.19.1
hooks:
- id: yamlfix
exclude: .pre-commit-config.yaml
Loading