Skip to content

Commit 539c421

Browse files
hmgaudeckerclaudepre-commit-ci[bot]MImmesberger
authored
Refactor piecewise polynomial (implement GEP-8) (#1132)
Refactor piecewise polynomial YAML and code for GEP-08, twin to [TTSIM #76](ttsim-dev/ttsim#76) Convert all piecewise polynomial YAML parameters from numbered dict format to ordered lists with explicit interval strings: - solidaritätszuschlag, einkommensteuertarif, vorsorge, behinderung, wohngeld, grundrente, bürgergeld/arbeitslosengeld_2 freibeträge, lohnsteuer vorsorge - Rename keys: rate_linear->slope, rate_quadratic->quadratic, intercept_at_lower_threshold->intercept - Update Python code to use new API (parameter_list instead of parameter_dict, new key names) - Fix rates shape indexing: [coeff, interval] -> [interval, coeff] in lohnsteuer.py and solidaritätszuschlag.py - Add extend_extend_intervals_to_real_line to fix stale adjacent intervals after upsert_tree merges in param_functions - Re-export extend_extend_intervals_to_real_line from gettsim.tt - Aside: Lots of infrastructure updates. --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Marvin Immesberger <immesberger@posteo.de> Co-authored-by: Marvin Immesberger <74215010+MImmesberger@users.noreply.github.com>
1 parent e0d468e commit 539c421

39 files changed

+7482
-5565
lines changed

.ai-instructions

Submodule .ai-instructions added at c852f89
Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,6 @@ on:
1212
branches:
1313
- '*'
1414
jobs:
15-
run-ty:
16-
name: Run ty
17-
runs-on: ubuntu-latest
18-
steps:
19-
- uses: actions/checkout@v6
20-
- uses: prefix-dev/setup-pixi@v0.9.4
21-
with:
22-
pixi-version: v0.63.2
23-
cache: true
24-
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
25-
frozen: true
26-
environments: py314
27-
- name: Run ty
28-
run: pixi run -e py314 ty
29-
shell: bash -el {0}
3015
run-tests:
3116
name: Run tests for ${{ matrix.os }} on ${{ matrix.environment }}
3217
runs-on: ${{ matrix.os }}
@@ -60,7 +45,7 @@ jobs:
6045
- uses: actions/checkout@v6
6146
- uses: prefix-dev/setup-pixi@v0.9.4
6247
with:
63-
pixi-version: v0.62.2
48+
pixi-version: v0.66.0
6449
cache: true
6550
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
6651
frozen: true
@@ -70,22 +55,40 @@ jobs:
7055
matrix.environment == 'py311' ||
7156
matrix.environment == 'py312' ||
7257
matrix.environment == 'py313'
73-
run: pixi run -e ${{ matrix.environment }} tests
58+
run: pixi run --locked -e ${{ matrix.environment }} tests
7459
shell: bash -el {0}
7560
- name: Run tests on Linux (with NumPy backend and coverage)
7661
if: runner.os == 'Linux' && matrix.environment == 'py314'
77-
run: pixi run -e ${{ matrix.environment }} tests --cov --cov-report=xml
62+
run: pixi run --locked -e ${{ matrix.environment }} tests-with-cov
7863
shell: bash -el {0}
7964
- name: Run tests on MacOS / Windows (with NumPy backend and without coverage)
8065
if: runner.os != 'Linux'
81-
run: pixi run -e ${{ matrix.environment }} tests
66+
run: pixi run --locked -e ${{ matrix.environment }} tests
8267
shell: bash -el {0}
8368
- name: Run tests with JAX backend
8469
if: matrix.environment == 'py314-jax'
85-
run: pixi run -e ${{ matrix.environment }} tests-jax
70+
run: pixi run --locked -e ${{ matrix.environment }} tests-jax
8671
shell: bash -el {0}
8772
- name: Upload coverage reports
8873
if: runner.os == 'Linux' && matrix.environment == 'py314'
89-
uses: codecov/codecov-action@v5
74+
uses: codecov/codecov-action@v5.5.2
9075
with:
9176
token: ${{ secrets.CODECOV_TOKEN }}
77+
run-ty:
78+
name: Run ty
79+
runs-on: ubuntu-latest
80+
steps:
81+
- uses: actions/checkout@v6
82+
- uses: prefix-dev/setup-pixi@v0.9.4
83+
with:
84+
pixi-version: v0.66.0
85+
cache: true
86+
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
87+
frozen: true
88+
environments: type-checking type-checking-jax
89+
- name: Run ty
90+
run: pixi run --locked ty
91+
shell: bash -el {0}
92+
- name: Run ty-jax
93+
run: pixi run --locked ty-jax
94+
shell: bash -el {0}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ jobs:
2828
--outdir dist/
2929
- name: Publish distribution 📦 to PyPI
3030
if: startsWith(github.ref, 'refs/tags')
31-
uses: pypa/gh-action-pypi-publish@release/v1
31+
uses: pypa/gh-action-pypi-publish@v1.13.0
3232
with:
3333
attestations: true

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,16 @@ docs/_build/
2121
.idea/
2222
.vscode/
2323

24-
# Jupyter
24+
# Jupyter / Jupyter Book
2525
.ipynb_checkpoints/
26+
_build
2627

2728
# macOS
2829
.DS_Store
2930

3031
# pixi
3132
.pixi/
33+
node_modules/
3234

3335
# Python
3436
__pycache__/

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[submodule ".ai-instructions"]
2+
path = .ai-instructions
3+
url = https://github.com/OpenSourceEconomics/ai-instructions.git
4+
branch = make-submodule

.pre-commit-config.yaml

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,42 @@ repos:
66
- id: check-useless-excludes
77
# - id: identity # Prints all files passed to pre-commits. Debugging.
88
- repo: https://github.com/tox-dev/pyproject-fmt
9-
rev: v2.12.1
9+
rev: v2.19.0
1010
hooks:
1111
- id: pyproject-fmt
1212
- repo: https://github.com/lyz-code/yamlfix
1313
rev: 1.19.1
1414
hooks:
1515
- id: yamlfix
16+
- repo: https://github.com/python-jsonschema/check-jsonschema
17+
rev: 0.37.0
18+
hooks:
19+
- id: check-github-workflows
20+
- id: check-jsonschema
21+
name: Validate JSON/YAML files against schema
22+
entry: check-jsonschema
23+
language: python
24+
files: ^src/gettsim/germany/.*\.(yaml|yml)$
25+
args:
26+
- --schemafile=docs/geps/params-schema.json
1627
- repo: https://github.com/pre-commit/pre-commit-hooks
1728
rev: v6.0.0
1829
hooks:
1930
- id: check-added-large-files
2031
args:
2132
- --maxkb=10000
33+
- id: check-ast
2234
- id: check-case-conflict
35+
- id: check-docstring-first
2336
- id: check-merge-conflict
37+
- id: check-toml
2438
- id: check-vcs-permalinks
2539
- id: check-yaml
26-
- id: check-toml
2740
- id: debug-statements
2841
- id: end-of-file-fixer
2942
- id: fix-byte-order-marker
3043
types:
3144
- text
32-
- id: forbid-submodules
3345
- id: mixed-line-ending
3446
args:
3547
- --fix=lf
@@ -39,14 +51,12 @@ repos:
3951
- --branch
4052
- main
4153
- id: trailing-whitespace
42-
- id: check-ast
43-
- id: check-docstring-first
4454
- repo: https://github.com/adrienverge/yamllint.git
4555
rev: v1.38.0
4656
hooks:
4757
- id: yamllint
4858
- repo: https://github.com/astral-sh/ruff-pre-commit
49-
rev: v0.15.0
59+
rev: v0.15.6
5060
hooks:
5161
- id: ruff-check
5262
args:
@@ -61,7 +71,7 @@ repos:
6171
- pyi
6272
- python
6373
- repo: https://github.com/kynan/nbstripout
64-
rev: 0.9.0
74+
rev: 0.9.1
6575
hooks:
6676
- id: nbstripout
6777
args:
@@ -78,10 +88,7 @@ repos:
7888
args:
7989
- --wrap
8090
- '88'
81-
files: (CLAUDE\.md|README\.md)
82-
- repo: https://github.com/executablebooks/mdformat
83-
rev: 1.0.0
84-
hooks:
91+
files: (AGENTS\.md|CLAUDE\.md|README\.md|CHANGES\.md|CODE_OF_CONDUCT\.md|modules/.*\.md|profiles/.*\.md)
8592
- id: mdformat
8693
additional_dependencies:
8794
- mdformat-myst
@@ -90,15 +97,5 @@ repos:
9097
- --wrap
9198
- '88'
9299
files: (docs/.|CHANGES.md|CODE_OF_CONDUCT.md)
93-
- repo: https://github.com/python-jsonschema/check-jsonschema
94-
rev: 0.36.1
95-
hooks:
96-
- id: check-jsonschema
97-
name: Validate JSON/YAML files against schema
98-
entry: check-jsonschema
99-
language: python
100-
files: ^src/gettsim/germany/.*\.(yaml|yml)$
101-
args:
102-
- --schemafile=docs/geps/params-schema.json
103100
ci:
104101
autoupdate_schedule: monthly

0 commit comments

Comments
 (0)