Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b86b0d6
Replace hand-written ty machinery with the official ty-pre-commit hoo…
hmgaudecker Jun 15, 2026
0fdc84b
Bump .ai-instructions to 68dc3f4 + adapt to ty 0.0.52 (#135)
hmgaudecker Jun 24, 2026
bfb08fc
pint units (GEP 10): framework core + time-as-a-dimension model
MImmesberger Jun 18, 2026
87e154a
Reject currency re-registration with an inconsistent conversion factor
MImmesberger Jun 23, 2026
82047cf
Add unit_residual_excluding_currency_and_flow_period helper
MImmesberger Jun 23, 2026
8556e90
pint units (GEP 10): grouping-level dimensions + [person] count
MImmesberger Jun 25, 2026
811e259
pint units (GEP 10): tests for grouping-level dimensions + [person] c…
MImmesberger Jun 25, 2026
ea9fce1
pint units (GEP 10): declarable HEADCOUNT token + COUNT mints it
MImmesberger Jun 26, 2026
c13cc6f
pint units (GEP 10): mandatory units + edge-consistency checks
MImmesberger Jun 18, 2026
dda76ef
pint units (GEP 10): orchestrate grouping levels (discover, resolve, …
MImmesberger Jun 25, 2026
455c827
pint units (GEP 10): update unit-check tests to the leveled reality
MImmesberger Jun 25, 2026
8070975
pint units (GEP 10): mint head counts for COUNT and SUM-over-boolean
MImmesberger Jun 25, 2026
a7dd4c8
pint units (GEP 10): admit HEADCOUNT in schema enum + COUNT mints it
MImmesberger Jun 26, 2026
514d133
test: reject cross-level mixing in function bodies (GEP 10)
MImmesberger Jun 26, 2026
7c344d0
pint units (GEP 10): derive and validate aggregation units
MImmesberger Jun 26, 2026
8fa1762
pint units (GEP 10): currency knob + Layer-2 boundary assertions
MImmesberger Jun 18, 2026
154b003
pint units (GEP 10): unit-annotated input/output boundary
MImmesberger Jun 19, 2026
65e13ec
pint units (GEP 10): per-axis currency conversion for require_converter
MImmesberger Jun 23, 2026
3e9f420
Check input tags for equivalence, not just dimensionality (GEP 10)
MImmesberger Jun 23, 2026
e1883c6
Constrain scalar params: no reference_period, single-token unit (GEP 10)
MImmesberger Jun 23, 2026
42f3784
pint units (GEP 10): reference_level on parameters
MImmesberger Jun 25, 2026
f949ac2
pint units (GEP 10): worked example for unit-annotated input/output
MImmesberger Jun 19, 2026
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/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ jobs:
cache: true
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
frozen: true
environments: type-checking type-checking-jax
- name: Run ty
run: pixi run --locked ty
environments: py314 py314-jax
- name: Run ty (numpy backend)
run: pixi run --locked -e py314 prek run ty --all-files
shell: bash -el {0}
- name: Run ty-jax
run: pixi run --locked ty-jax
- name: Run ty (jax backend)
run: pixi run --locked -e py314 prek run ty-jax --all-files
shell: bash -el {0}
38 changes: 35 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ repos:
- id: check-useless-excludes
# - id: identity # Prints all files passed to pre-commits. Debugging.
- repo: https://github.com/tox-dev/pyproject-fmt
rev: v2.23.0
rev: v2.25.0
hooks:
- id: pyproject-fmt
- repo: https://github.com/lyz-code/yamlfix
rev: 1.19.1
hooks:
- id: yamlfix
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.2
rev: 0.37.3
hooks:
- id: check-github-workflows
- id: check-jsonschema
Expand Down Expand Up @@ -59,7 +59,7 @@ repos:
hooks:
- id: yamllint
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.15
rev: v0.15.19
hooks:
- id: ruff-check
args:
Expand All @@ -73,6 +73,33 @@ repos:
- jupyter
- pyi
- python
- repo: https://github.com/astral-sh/ty-pre-commit
rev: v0.0.52
hooks:
- id: ty
name: ty (numpy backend)
# `--no-project` keeps uv from creating a `.venv`/`uv.lock` in this
# pixi-managed repo; ty resolves third-party imports from the pixi
# environment configured via `tool.ty.environment.python` in
# pyproject.toml (requires `pixi install -e py314` once).
args:
- --no-project
- repo: local
hooks:
- id: ty-jax
name: ty (jax backend)
# Same `tool.ty` configuration from pyproject.toml; only the
# environment ty resolves third-party imports from is overridden
# (requires `pixi install -e py314-jax` once). A local hook because
# the official hook's `uv check` does not forward `--python` to ty.
# Keep the ty pin in sync with the `ty-pre-commit` rev above.
language: python
additional_dependencies:
- ty==0.0.49
entry: ty check --python .pixi/envs/py314-jax
pass_filenames: false
always_run: true
require_serial: true
- repo: https://github.com/kynan/nbstripout
rev: 0.9.1
hooks:
Expand All @@ -94,3 +121,8 @@ repos:
files: (AGENTS\.md|CLAUDE\.md|README\.md|CHANGES\.md|CODE_OF_CONDUCT\.md|modules/.*\.md|profiles/.*\.md)
ci:
autoupdate_schedule: monthly
# pre-commit.ci blocks network access at hook runtime and has no pixi
# environments; the `run-ty` job in GitHub Actions covers type checking.
skip:
- ty
- ty-jax
15 changes: 8 additions & 7 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,19 @@ pixi run -e py314 pytest tests/test_main.py
# Run a single test
pixi run -e py314 pytest tests/test_main.py::test_function_name -v

# Type checking with ty
pixi run -e ty ty
# Type checking with ty (runs as pre-commit hooks against the py314 and
# py314-jax environments; requires both to be installed)
prek run ty --all-files
prek run ty-jax --all-files

# Available environments: py311, py312, py313, py314, py314-jax, py314-cuda, py314-metal, ty
# Available environments: py311, py312, py313, py314, py314-jax, py314-cuda, py314-metal
```

Before finishing any task that modifies code, always run these three verification steps
in order:
Before finishing any task that modifies code, always run these two verification steps in
order:

1. `pixi run ty` (type checker)
1. `pixi run -e py314-jax prek run --all-files` (quality checks: linting, formatting,
yaml, etc.)
yaml, type checking with ty under both backends, etc.)
1. `pixi run -e py314-jax tests -n 7` (full test suite)

Pre-commit hooks run automatically via pre-commit.ci. Linting uses Ruff with `ALL` rules
Expand Down
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ releases are available on [Anaconda.org](https://anaconda.org/conda-forge/ttsim)
(computable from `processed_data` alone) and `raw_results.columns_with_original_p_ids`
(the reverse-translation of endogenous `p_id_*` columns from {gh}`108`).
({ghuser}`MImmesberger`)
- {gh}`121` Switch the GEP-10 unit checks on: two always-on `fail_if` nodes verify every
assembled policy environment — mandatory `unit=` declarations on all active nodes and
a conservative dry-run of every function body against its producers' resolved units.
Annotate mettsim end to end as the worked example, and check it over all policy dates
in CI. ({ghuser}`MImmesberger`)
- Fill in the `count_by_p_id`, `mean_by_p_id`, `max_by_p_id`, `min_by_p_id`,
`any_by_p_id`, and `all_by_p_id` aggregations on both the NumPy and JAX backends.
Negative source `p_id` entries are masked out so they cannot influence the result;
Expand Down
Loading
Loading