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
34 changes: 20 additions & 14 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,44 +24,50 @@ jobs:
- macos-latest # arm
- windows-latest
environment:
- py311
- py312
- py313
- py314
- py315
steps:
- uses: actions/checkout@v6
- uses: prefix-dev/setup-pixi@v0.9.4
- uses: actions/checkout@v7.0.1
- uses: prefix-dev/setup-pixi@v0.11.3
with:
pixi-version: v0.68.1
pixi-version: v0.84.2
cache: true
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
frozen: true
environments: ${{ matrix.environment }}
- name: Run all tests except Linux and py314.
if: runner.os != 'Linux' || matrix.environment != 'py314'
shell: bash -el {0}
run: pixi run -e ${{ matrix.environment }} tests
run: pixi run --locked -e ${{ matrix.environment }} tests
- name: Run tests with codecov on Linux and py314.
if: runner.os == 'Linux' && matrix.environment == 'py314'
shell: bash -el {0}
run: pixi run -e ${{ matrix.environment }} tests-with-cov
run: pixi run --locked -e ${{ matrix.environment }} tests-with-cov
- name: Upload coverage report.
if: runner.os == 'Linux' && matrix.environment == 'py314'
uses: codecov/codecov-action@v6
uses: codecov/codecov-action@v7.1.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
run-ty:
name: Run ty
code-analysis:
name: Code analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: prefix-dev/setup-pixi@v0.9.4
- uses: actions/checkout@v7.0.1
with:
pixi-version: v0.68.1
# `.ai-instructions` carries the dead-code script.
submodules: true
- uses: prefix-dev/setup-pixi@v0.11.3
with:
pixi-version: v0.84.2
cache: true
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
frozen: true
environments: py314
- name: Run ty
run: pixi run -e py314 ty
- name: Check types
run: pixi run --locked -e py314 prek run ty --all-files
shell: bash -el {0}
- name: Check for unused code
run: pixi run --locked -e py314 prek run dead-code --all-files
shell: bash -el {0}
8 changes: 4 additions & 4 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ jobs:
name: Build and publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Python 3.12
uses: actions/setup-python@v6
- uses: actions/checkout@v7.0.1
- name: Set up Python 3.14
uses: actions/setup-python@v7.1.0
with:
python-version: '3.12'
python-version: '3.14'
- name: Install pypa/build
run: >-
python -m
Expand Down
100 changes: 95 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ repos:
- id: check-hooks-apply
- id: check-useless-excludes
- repo: https://github.com/tox-dev/pyproject-fmt
rev: v2.21.2
rev: v2.31.2
hooks:
- id: pyproject-fmt
- repo: https://github.com/lyz-code/yamlfix
Expand Down Expand Up @@ -47,11 +47,11 @@ repos:
hooks:
- id: yamllint
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.2
rev: 0.39.0
hooks:
- id: check-github-workflows
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.12
rev: v0.17.6
hooks:
- id: ruff-check
args:
Expand All @@ -65,8 +65,17 @@ repos:
- jupyter
- pyi
- python
- repo: https://github.com/astral-sh/ty-pre-commit
rev: v0.0.108
hooks:
- id: ty
# Run ty directly so import resolution uses `[tool.ty] environment.python`.
# Keep this dependency pin aligned with the hook revision above.
entry: ty check
additional_dependencies:
- ty==0.0.108
- repo: https://github.com/kynan/nbstripout
rev: 0.9.1
rev: 0.9.2
hooks:
- id: nbstripout
args:
Expand All @@ -83,7 +92,7 @@ repos:
args:
- --wrap
- '88'
files: (AGENTS\.md|CLAUDE\.md|README\.md)
files: (AGENTS\.md|README\.md)
- id: mdformat
additional_dependencies:
- mdformat-myst
Expand All @@ -92,5 +101,86 @@ repos:
- --wrap
- '88'
files: docs/.
- repo: https://github.com/codespell-project/codespell
rev: v2.4.3
hooks:
- id: codespell
additional_dependencies:
- tomli
- repo: local
hooks:
# Runs at pre-commit stage and fails if the config declares pre-push hooks
# that this clone never installed — otherwise they look active and silently
# never fire.
- id: pre-push-hooks-installed
name: pre-push hooks are installed in this clone
entry: .ai-instructions/hooks/check_pre_push_installed.py
language: script
pass_filenames: false
always_run: true
# `--check` re-solves and compares without writing, so it cannot dirty the
# worktree. pre-push, not pre-commit: a mid-branch commit may legitimately
# lag the lock, but a push with a stale lock burns a CI cycle.
- id: pixi-lock-check
name: pixi.lock is in sync with the manifest
entry: pixi lock --check
language: system
pass_filenames: false
files: ^(pyproject\.toml|pixi\.toml|pixi\.lock)$
stages:
- pre-push
- id: notebook-cell-source-format
name: notebook cell source is a JSON array of lines
entry: .ai-instructions/hooks/fix_notebook_cell_source.py
language: script
types:
- jupyter
# Whole-repository analysis: a change in one file can orphan code in another.
- id: dead-code
name: no internal or test code without a caller
entry: python .ai-instructions/hooks/dead_code.py
language: python
additional_dependencies:
- vulture==2.16
pass_filenames: false
files: \.py$|^pyproject\.toml$
- id: no-hardcoded-user-paths
name: no hardcoded user-specific absolute paths
language: pygrep
entry: (/home/[A-Za-z0-9_.-]+/|/Users/[A-Za-z0-9_.-]+/|[A-Za-z]:\\Users\\)
types_or:
- python
- toml
- id: no-section-separator-comments
name: no decorative section-separator comments
language: pygrep
entry: ^\s*#\s*[-=#_*]{10,}\s*$
types:
- python
# Catches the labelled forms only — PR/issue numbers, `E<n>`/`F<n>`
# finding labels, `round-<n>`, `pre-fix`. Prose that rehearses history
# without a label stays a review responsibility.
- id: no-internal-references
name: no references a reader cannot reach from the checkout
language: pygrep
entry: (?:^|[\s(\[])\#[0-9]{2,5}\b(?!\.[0-9])|(?i:\b(?:round|wave)-[0-9]+\b)|(?i:\b(?:audit|review|finding|witness|defect|bug|fix|guard)\s+)(?:finding\s+)?[EF][0-9]{1,2}\b|\b[EF][0-9]{1,2}(?i:\s+(?:fix|guard|bug|defect|witness|signature|regression|finding|audit)\b)|(?:^|\s)\((?:the\s+)?(?!(?:F8|F16|F32|F64)\b)[EF][0-9]{1,2}['’]?(?:\s*[,/]\s*[EF][0-9]{1,2}['’]?)*(?:[,)\s])|(?i:\b(?:pre|post)-fix\b)
types:
- python
ci:
autoupdate_schedule: monthly
# pre-commit.ci has no pixi environments and blocks network at hook runtime;
# the GitHub Actions `code-analysis` job covers type checking, and pixi-lock-check
# needs a pixi binary that pre-commit.ci does not provide.
#
# The hooks above that run files from the `.ai-instructions` submodule
# fail as a missing file on pre-commit.ci, which clones without submodules.
# `pre-push-hooks-installed` asks about the local clone and is meaningless on
# a runner anyway; `dead-code` runs in the GitHub Actions `code-analysis` job, which
# checks out the submodule; the notebook check loses CI coverage and holds
# only where the submodule is present.
skip:
- ty
- pixi-lock-check
- pre-push-hooks-installed
- notebook-cell-source-format
- dead-code
17 changes: 8 additions & 9 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ annotations, and execute function graphs.
This project uses [pixi](https://pixi.sh) for environment management.

```bash
pixi run -e py313 tests # Run tests with Python 3.13
pixi run -e py314 tests # Run tests with Python 3.14
pixi run -e py313 tests-with-cov # Run tests with coverage
pixi run ty # Type checking
prek run --all-files # Linting & formatting
pixi run -e docs build-docs # Build HTML docs with Jupyter Book
pixi run -e docs view-docs # Live preview of docs
pixi run -e py315 tests # Run tests with Python 3.15
pixi run -e py314 tests-with-cov # Run tests with coverage
prek run ty --all-files # Type checking (ty runs as a prek hook)
prek run --all-files # Linting, formatting & type checking
pixi run -e docs build-docs # Build HTML docs with Jupyter Book
pixi run -e docs view-docs # Live preview of docs
```

Available Python environments: `py311`, `py312`, `py313`, `py314`
Available Python environments: `py312`, `py313`, `py314`, `py315`

Documentation uses **Jupyter Book 2.0** with **MyST** markdown. Config is in
`docs/myst.yml`. Docs include executable Jupyter notebooks.
Expand All @@ -37,7 +37,6 @@ src/dags/
├── exceptions.py # Custom exceptions
├── output.py # Output processing utilities
├── signature.py # Function signature utilities
├── typing.py # Type definitions
├── utils.py # General utilities
└── tree/ # Tree-related utilities

Expand Down Expand Up @@ -67,7 +66,7 @@ tests/
## Code Style

- Does **not** use `from __future__ import annotations` or `TYPE_CHECKING` blocks
- Ruff for linting (target: Python 3.11)
- Ruff for linting (target: Python 3.12)
- ty for type checking (all rules set to error)
- Google docstring convention
- User-facing APIs accept `Sequence` (not `list`) for input parameters
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ releases are available on [conda-forge](https://anaconda.org/conda-forge/dags).

## Unreleased

- :gh:`90` Support Python 3.15, drop Python 3.11, modernize type annotations,
and update development tools (:ghuser:`hmgaudecker`).

## 0.6.0

- :gh:`82` Make dags wrappers play nicely with runtime type checkers
Expand Down
1 change: 0 additions & 1 deletion CLAUDE.md

This file was deleted.

1 change: 0 additions & 1 deletion GEMINI.md

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ More examples can be found in the
hard coding the combined function.
- When there is more than one target, you can determine whether the result is returned
as tuple, list or dict or pass in an aggregator to combine the multiple outputs.
- Since the relationships are discoverd from function signatures, dags provides
- Since the relationships are discovered from function signatures, dags provides
decorators to rename arguments in order to make it easy to wrap functions you do not
control yourself.

Expand Down
Loading
Loading