-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathpyproject.toml
More file actions
354 lines (344 loc) · 12.7 KB
/
pyproject.toml
File metadata and controls
354 lines (344 loc) · 12.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
[build-system]
build-backend = "hatchling.build"
requires = [ "hatch-vcs", "hatchling" ]
[project]
name = "gettsim"
description = "The German Taxes and Transfers SIMulator"
readme = { file = "README.md", content-type = "text/markdown" }
keywords = [
"Benefits",
"Economics",
"Germany",
"Pensions",
"Taxes",
"Transfers",
]
license = { file = "LICENSE" }
requires-python = ">=3.11"
classifiers = [
"Intended Audience :: Science/Research",
"License :: OSI Approved :: GNU Affero General Public License v3",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Operating System :: Unix",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
]
dynamic = [ "version" ]
# dependencies = [ "ttsim-backend>=1.2" ]
[[project.authors]]
name = "Christian Zimpelmann"
[[project.authors]]
name = "Hans-Martin von Gaudecker"
email = "hmgaudecker@uni-bonn.de"
[[project.authors]]
name = "Marvin Immesberger"
[[project.maintainers]]
name = "Hans-Martin von Gaudecker"
email = "hmgaudecker@uni-bonn.de"
[[project.maintainers]]
name = "Marvin Immesberger"
[project.urls]
Changelog = "https://gettsim.readthedocs.io/en/stable/changes.html"
Documentation = "https://gettsim.readthedocs.io"
Github = "https://github.com/ttsim-dev/gettsim"
Repository = "https://github.com/ttsim-dev/gettsim"
Tracker = "https://github.com/ttsim-dev/gettsim/issues"
[tool.hatch]
build.hooks.vcs.version-file = "src/gettsim/_version.py"
build.targets.sdist.exclude = [ "tests" ]
build.targets.sdist.only-packages = true
build.targets.wheel.only-include = [ "src" ]
build.targets.wheel.sources = [ "src" ]
metadata.allow-direct-references = true
version.source = "vcs"
[tool.ruff]
fix = true
unsafe-fixes = false
[tool.ruff.lint]
select = [ "ALL" ]
extend-ignore = [
"COM812", # Avoid conflicts with ruff-format
"D", # Docstrings
"EM101", # Exception must not use a string literal
"EM102", # Exception must not use an f-string literal
"F722", # https://docs.kidger.site/jaxtyping/faq/#flake8-or-ruff-are-throwing-an-error
"FBT001", # Boolean-typed positional argument in function definition
"FBT002", # Boolean default positional argument in function definition
"FIX002", # Line contains TODO -- Use stuff from TD area.
"ICN001", # numpy should be np, but different convention here.
"ISC001", # Avoid conflicts with ruff-format
"S301", # pickle module (standard intermediate format)
# TC001-TC003: TYPE_CHECKING guards. Always ignore for Python 3.14+ projects
# (PEP 649 deferred evaluation makes them unnecessary).
"TC001", # Move application import into a type-checking block
"TC002", # Move third-party import into a type-checking block
"TC003", # Move standard library import into a type-checking block
"N999", # Allow non-ASCII characters in file names.
"PLC2401", # Allow non-ASCII characters in variable names.
"PLC2403", # Allow non-ASCII function names for imports.
"PLR0913", # Allow many arguments in function definitions.
"PLR5501", # elif not supported by vectorization converter for Jax
"TRY003", # Avoid specifying long messages outside the exception class
]
per-file-ignores."conftest.py" = [
"ANN", # Type annotations not needed in conftest
]
per-file-ignores."docs/*" = [
"INP001", # Implicit namespace packages
"T201", # print() usage OK in docs
]
per-file-ignores."docs/how_to_guides/modifications_of_policy_environments.ipynb" = [
"E402", # Module-level import not at top of cell
]
per-file-ignores."docs/tutorials/personas.ipynb" = [
"E501", # Line too long
]
per-file-ignores."src/gettsim/__init__.py" = [
"PLW0127", # Re-export things for tab-completion explicitly.
"PT028", # Cannot have default values in test functions with fixtures -- not an issue here.
]
per-file-ignores."src/gettsim/germany/*" = [
"E501", # Line too long — policy functions have long expressions
"E721", # Do not compare types, use isinstance() — needed for type(x) == type(y)
"PLR1714", # Consider merging multiple comparisons with in
"PLR1716", # Boolean expression may be simplified with chained comparison
"RET", # Flake8-return — vectorization requires specific return patterns
"SIM108", # Use ternary operator — vectorization requires if/else blocks
]
per-file-ignores."src/gettsim/germany/familie/familie.py" = [
"PLR2004", # Magic value used in comparison
]
per-file-ignores."src/gettsim/germany/lohnsteuer/*.py" = [
"PLR2004", # Magic value used in comparison
]
per-file-ignores."src/gettsim/plot/dag/__init__.py" = [
"PLW0127", # Self-assignment of variable — re-exports for tab-completion
]
per-file-ignores."src/gettsim/tests_germany/**/*.py" = [
"ANN", # Type annotations not required in tests
"S101", # Use of assert
]
per-file-ignores."src/gettsim/typing.py" = [
"F401", # Imported but unused — re-exports
]
pydocstyle.convention = "google"
[tool.pyproject-fmt]
column_width = 88
max_supported_python = "3.14"
table_format = "long"
collapse_tables = [ "tool.hatch", "tool.pytest", "tool.ty" ]
expand_tables = [
"tool.pixi.dependencies",
"tool.pixi.environments",
"tool.pixi.feature.coverage.tasks",
"tool.pixi.feature.cuda",
"tool.pixi.feature.cuda.target.linux-64.pypi-dependencies",
"tool.pixi.feature.cuda.tasks",
"tool.pixi.feature.docs.dependencies",
"tool.pixi.feature.docs.pypi-dependencies",
"tool.pixi.feature.docs.target.linux-64.tasks",
"tool.pixi.feature.docs.target.osx-64.tasks",
"tool.pixi.feature.docs.target.osx-arm64.tasks",
"tool.pixi.feature.docs.target.win-64.tasks",
"tool.pixi.feature.jax",
"tool.pixi.feature.jax.pypi-dependencies",
"tool.pixi.feature.jax.target.linux-64.tasks",
"tool.pixi.feature.jax.target.osx-arm64.tasks",
"tool.pixi.feature.jax.target.win-64.tasks",
"tool.pixi.feature.metal",
"tool.pixi.feature.metal.target.osx-arm64.pypi-dependencies",
"tool.pixi.feature.py311.dependencies",
"tool.pixi.feature.py312.dependencies",
"tool.pixi.feature.py313.dependencies",
"tool.pixi.feature.py314.dependencies",
"tool.pixi.feature.tests.pypi-dependencies",
"tool.pixi.feature.tests.target.linux-64.tasks",
"tool.pixi.feature.tests.target.osx-64.tasks",
"tool.pixi.feature.tests.target.osx-arm64.tasks",
"tool.pixi.feature.tests.target.win-64.tasks",
"tool.pixi.feature.type-checking.pypi-dependencies",
"tool.pixi.feature.type-checking.tasks",
"tool.pixi.feature.type-checking-jax.pypi-dependencies",
"tool.pixi.feature.type-checking-jax.tasks",
"tool.pixi.pypi-dependencies",
"tool.pixi.tasks",
"tool.pixi.workspace",
]
[tool.ty]
overrides = [
{ include = [ "docs/**" ], rules.unresolved-attribute = "ignore", rules.invalid-argument-type = "ignore" },
]
rules.ambiguous-protocol-member = "error"
rules.deprecated = "error"
rules.division-by-zero = "error"
rules.empty-body = "ignore" # raised for all functions decorated with @policy_input
rules.ignore-comment-unknown-rule = "error"
rules.ineffective-final = "error"
rules.invalid-enum-member-annotation = "error"
rules.invalid-ignore-comment = "error"
rules.invalid-legacy-positional-parameter = "error"
rules.invalid-return-type = "ignore"
rules.possibly-missing-submodule = "error"
rules.redundant-cast = "error"
rules.unused-awaitable = "error"
rules.unused-ignore-comment = "error"
[tool.pytest]
ini_options.addopts = [ "--pdbcls=pdbp:Pdb" ]
ini_options.filterwarnings = [
"ignore:.*XMLParser*:DeprecationWarning",
"ignore:.*'tree.iter()'*:PendingDeprecationWarning",
"ignore:.*Sorting*:FutureWarning",
"ignore:The TerminalReporter.writer attribute is",
"ignore:Repeated execution of the test suite",
"ignore:Using or importing the ABCs from 'collections'",
"ignore:Explicitly requested dtype .*64 requested in zeros_like",
]
ini_options.markers = [
"wip: Tests that are work-in-progress.",
"unit: Flag for unit tests which target mainly a single function.",
"integration: Flag for integration tests which may comprise of multiple unit tests.",
"end_to_end: Flag for tests that cover the whole program.",
"skipif_jax: skip test if backend is jax",
"skipif_numpy: skip test if backend is numpy",
]
ini_options.norecursedirs = [ "docs" ]
ini_options.testpaths = [ "src/gettsim/tests_germany" ]
[tool.coverage.report]
exclude_lines = [ "pragma: no cover", "if TYPE_CHECKING:", "^\\s*pass\\s*$" ]
[tool.coverage.run]
source = [ "src/gettsim/germany" ]
omit = [
"*/__init__.py",
".pixi/*",
"*/test_jittability.py",
"*/tests_germany/*",
"*/_version.py",
]
branch = true
[tool.pixi.dependencies]
ipywidgets = "*"
jupyterlab = "*"
numpy_groupies = "*"
numpydoc = "*"
openpyxl = "*"
pandas = ">=3"
prek = "*"
pygments = "*"
pygraphviz = "*"
pyyaml = "*"
snakeviz = ">=2.2.2"
tabulate = "*"
toml = "*"
[tool.pixi.environments]
py311 = [ "py311", "tests" ]
py312 = [ "py312", "tests" ]
py313 = [ "py313", "tests" ]
py314 = [ "py314", "tests", "coverage" ]
py314-cuda = [ "py314", "tests", "cuda" ]
py314-jax = [ "py314", "tests", "jax" ]
type-checking = [ "py314", "type-checking" ]
type-checking-jax = [ "py314", "type-checking-jax", "jax" ]
py314-metal = [ "py314", "tests", "metal" ]
docs = [ "docs", "py313" ]
[tool.pixi.feature.coverage.tasks]
tests-with-cov = """\
pytest --cov-report=xml --cov=./ \
--ignore=src/gettsim/tests_germany/test_jittability.py\
"""
[tool.pixi.feature.cuda]
platforms = [ "linux-64" ]
system-requirements = { cuda = "13" }
[tool.pixi.feature.cuda.target.linux-64.pypi-dependencies]
jax = { version = ">=0.8", extras = [ "cuda13" ] }
[tool.pixi.feature.cuda.tasks]
tests-cuda = "pytest --backend=jax"
[tool.pixi.feature.docs.dependencies]
myst-parser = "*"
nbsphinx = "*"
pydata-sphinx-theme = "*"
sphinx = "*"
sphinx-automodapi = "*"
sphinx-copybutton = "*"
[tool.pixi.feature.docs.pypi-dependencies]
gettsim = { path = ".", editable = true }
gettsim-personas = { git = "https://github.com/ttsim-dev/gettsim-personas.git", branch = "main" }
[tool.pixi.feature.docs.target.linux-64.tasks]
docs = "sphinx-build -T -b html docs docs/_build/html"
[tool.pixi.feature.docs.target.osx-64.tasks]
docs = "dot -c && sphinx-build -T -b html docs docs/_build/html"
[tool.pixi.feature.docs.target.osx-arm64.tasks]
docs = "dot -c && sphinx-build -T -b html docs docs/_build/html"
[tool.pixi.feature.docs.target.win-64.tasks]
docs = "sphinx-build -T -b html docs docs/_build/html"
[tool.pixi.feature.jax]
platforms = [ "linux-64", "osx-arm64", "win-64" ]
[tool.pixi.feature.jax.pypi-dependencies]
jax = ">=0.8"
[tool.pixi.feature.jax.target.linux-64.tasks]
tests-jax = "pytest --backend=jax"
[tool.pixi.feature.jax.target.osx-arm64.tasks]
tests-jax = "dot -c && pytest --backend=jax" # dot -c needed for pygraphviz on macOS
[tool.pixi.feature.jax.target.win-64.tasks]
tests-jax = "pytest --backend=jax"
[tool.pixi.feature.metal]
platforms = [ "osx-arm64" ]
[tool.pixi.feature.metal.target.osx-arm64.pypi-dependencies]
jax = ">=0.8"
jax-metal = ">=0.1.1"
[tool.pixi.feature.py311.dependencies]
python = "~=3.11.0"
[tool.pixi.feature.py312.dependencies]
python = "~=3.12.0"
[tool.pixi.feature.py313.dependencies]
python = "~=3.13.0"
[tool.pixi.feature.py314.dependencies]
python = "~=3.14.0"
[tool.pixi.feature.tests.pypi-dependencies]
pytest = "*"
pytest-cov = "*"
pytest-profiling = "*"
pytest-xdist = "*"
gettsim-personas = { git = "https://github.com/ttsim-dev/gettsim-personas.git", branch = "main" }
[tool.pixi.feature.tests.target.linux-64.tasks]
tests = "pytest"
[tool.pixi.feature.tests.target.osx-64.tasks]
tests = "dot -c && pytest" # dot -c needed for pygraphviz on macOS
[tool.pixi.feature.tests.target.osx-arm64.tasks]
tests = "dot -c && pytest" # dot -c needed for pygraphviz on macOS
[tool.pixi.feature.tests.target.win-64.tasks]
tests = "pytest"
[tool.pixi.feature.tests.tasks]
[tool.pixi.feature.type-checking-jax.pypi-dependencies]
ty = "*"
types-PyYAML = "*"
types-pytz = "*"
gettsim-personas = { git = "https://github.com/ttsim-dev/gettsim-personas.git", branch = "main" }
[tool.pixi.feature.type-checking-jax.tasks]
ty-jax = "ty check"
[tool.pixi.feature.type-checking.pypi-dependencies]
ty = "*"
types-PyYAML = "*"
types-pytz = "*"
gettsim-personas = { git = "https://github.com/ttsim-dev/gettsim-personas.git", branch = "main" }
[tool.pixi.feature.type-checking.tasks]
ty = "ty check"
[tool.pixi.pypi-dependencies]
gettsim = { path = ".", editable = true }
jaxtyping = ">=0.3.2"
kaleido = ">=1.0.0"
pdbp = ">=1.7.1"
dags = ">=0.5"
ttsim-backend = { git = "https://github.com/ttsim-dev/ttsim.git", branch = "main" }
[tool.pixi.workspace]
channels = [ "conda-forge" ]
platforms = [ "linux-64", "osx-64", "osx-arm64", "win-64" ]
[tool.yamlfix]
line_length = 88
sequence_style = "block_style"
none_representation = "null"