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
36 changes: 36 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This file is part of the tschm/.config-templates repository
# (https://github.com/tschm/.config-templates).
#
root = true

# Default settings for all files
[*]
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
charset = utf-8

# Python, reStructuredText, and text files
[*.{py,rst,txt}]
indent_style = space
indent_size = 4

# YAML, JSON, and other config files
[*.{yml,yaml,json}]
indent_style = space
indent_size = 2

# Markdown files
# [*.{md,markdown}]
# trim_trailing_whitespace = false

# Don't apply editorconfig rules to vendor/ resources
# This is a "defensive" rule for the day we may have
# the vendor folder
[vendor/**]
charset = unset
end_of_line = unset
indent_size = unset
indent_style = unset
insert_final_newline = unset
trim_trailing_whitespace = unset
5 changes: 0 additions & 5 deletions .flake8

This file was deleted.

8 changes: 8 additions & 0 deletions .github/actions/setup-project/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,11 @@ runs:
else
echo "No pyproject.toml found, skipping package installation"
fi

- name: Show dependencies
shell: bash
run: uv pip list

- name: Show Python version
shell: bash
run: uv run python -c "import sys; print(sys.version)"
55 changes: 0 additions & 55 deletions .github/workflows/codecov.yml

This file was deleted.

181 changes: 172 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,86 @@ concurrency:
cancel-in-progress: true

jobs:
code-quality:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v5

- uses: actions/setup-python@v6
with:
python-version: '3.13'

- name: install pre-commit
run: python3 -m pip install pre-commit

- name: Checkout code
uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Get changed files
id: changed-files
run: |
CHANGED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | tr '\n' ' ')
echo "CHANGED_FILES=${CHANGED_FILES}" >> $GITHUB_ENV

- name: Print changed files
run: |
echo "Changed files: $CHANGED_FILES"

- name: Run pre-commit on changed files
run: |
if [ -n "$CHANGED_FILES" ]; then
pre-commit run --color always --files $CHANGED_FILES --show-diff-on-failure
else
echo "No changed files to check."
fi

pytest-nosoftdeps:
needs: code-quality
name: nosoftdeps (${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
env:
MPLBACKEND: Agg # https://github.com/orgs/community/discussions/26434
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
fail-fast: false # to not fail all combinations if just one fails

steps:
- uses: actions/checkout@v5

- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}

- name: Display Python version
run: python -c "import sys; print(sys.version)"

- name: Install dependencies
shell: bash
run: uv pip install ".[dev]" --no-cache-dir
env:
UV_SYSTEM_PYTHON: 1

- name: Show dependencies
run: uv pip list

- name: Test with pytest
run: |
pytest ./tests

pytest:
name: py${{ matrix.python-version }} on ${{ matrix.os }}
needs: pytest-nosoftdeps
name: (${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
env:
MPLBACKEND: Agg # https://github.com/orgs/community/discussions/26434
Expand Down Expand Up @@ -54,14 +132,99 @@ jobs:
run: |
pytest ./tests

- name: Check with isort
run: |
isort --check --diff .
codecov:
name: coverage (${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: code-quality
env:
MPLBACKEND: Agg # https://github.com/orgs/community/discussions/26434
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.12"]

- name: Check with black
run: |
black --check --diff .
steps:
- uses: actions/checkout@v5

- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}

- name: Display Python version
run: python -c "import sys; print(sys.version)"

- name: Check with flake8
- name: Install dependencies
shell: bash
run: uv pip install ".[dev,all_extras]" --no-cache-dir
env:
UV_SYSTEM_PYTHON: 1

- name: Show dependencies
run: uv pip list

- name: Generate coverage report
run: |
flake8 --show-source --statistics .
pip install pytest pytest-cov
pytest --cov=./ --cov-report=xml

- name: Upload coverage to Codecov
# if false in order to skip for now
if: false
uses: codecov/codecov-action@v5
with:
files: ./coverage.xml
fail_ci_if_error: true

notebooks:
needs: code-quality
runs-on: ubuntu-latest

strategy:
matrix:
python-version: [ '3.10', '3.11', '3.12', '3.13', '3.14' ]
fail-fast: false

steps:
- uses: actions/checkout@v5

- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}

- name: Display Python version
run: python -c "import sys; print(sys.version)"

- name: Install dependencies
shell: bash
run: uv pip install ".[dev,all_extras,notebook_test]" --no-cache-dir
env:
UV_SYSTEM_PYTHON: 1

- name: Show dependencies
run: uv pip list

# Discover all notebooks
- name: Collect notebooks
id: notebooks
shell: bash
run: |
NOTEBOOKS=$(find cookbook -name '*.ipynb' -print0 | xargs -0 echo)
echo "notebooks=$NOTEBOOKS" >> $GITHUB_OUTPUT

# Run all discovered notebooks with nbmake
- name: Test notebooks
shell: bash
run: |
uv run pytest --reruns 3 --nbmake --nbmake-timeout=3600 -vv ${{ steps.notebooks.outputs.notebooks }}
15 changes: 15 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-toml
- id: check-yaml

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.14.5'
hooks:
- id: ruff
args: [ --fix, --exit-non-zero-on-fix, --unsafe-fixes ]

# Run the formatter
- id: ruff-format
Loading