-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpyproject.toml
More file actions
304 lines (296 loc) · 10.3 KB
/
pyproject.toml
File metadata and controls
304 lines (296 loc) · 10.3 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
[build-system]
build-backend = "hatchling.build"
requires = [ "hatch-vcs", "hatchling" ]
[project]
name = "pylcm"
description = "Specification, solution, and simulation of finite-horizon dynamic choice models."
keywords = [
"Dynamic programming",
"Econometrics",
"Economics",
"Estimation",
"Life cycle models",
"Statistics",
]
requires-python = ">=3.14"
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Operating System :: Unix",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.14",
"Topic :: Scientific/Engineering",
"Typing :: Typed",
]
dynamic = [ "version" ]
dependencies = [
"cloudpickle>=3.1.2",
"dags>=0.5.1",
"h5py>=3.12",
"jax>=0.9",
"jaxtyping>=0.3.2",
"pandas",
"portion>=2.6",
]
[[project.authors]]
name = "Tim Mensinger"
email = "mensingertim@gmail.com"
[[project.authors]]
name = "Maximilian Jahn"
[[project.authors]]
name = "Janos Gabler"
[[project.authors]]
name = "Hans-Martin von Gaudecker"
email = "hmgaudecker@uni-bonn.de"
[project.license]
file = "LICENSE"
[[project.maintainers]]
name = "Tim Mensinger"
email = "mensingertim@gmail.com"
[[project.maintainers]]
name = "Hans-Martin von Gaudecker"
email = "hmgaudecker@uni-bonn.de"
[project.readme]
content-type = "text/markdown"
file = "README.md"
[project.urls]
Github = "https://github.com/opensourceeconomics/pylcm"
Repository = "https://github.com/opensourceeconomics/pylcm"
Tracker = "https://github.com/opensourceeconomics/pylcm/issues"
[tool.hatch]
build.hooks.vcs.version-file = "src/lcm/_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.pixi.dependencies]
asv = "*"
python = "~=3.14.0"
cloudpickle = ">=3.1.2,<4"
h5py = ">=3.12"
jupyterlab = "*"
memory_profiler = "*"
numpy = ">=2.4"
plotly = ">=6.5"
prek = "*"
pyarrow = "*"
pybaum = "*"
scipy = ">=1.16"
snakeviz = "*"
[tool.pixi.environments]
cuda12 = { features = [ "cuda12" ], solve-group = "cuda12" }
cuda13 = { features = [ "cuda13" ], solve-group = "cuda13" }
docs = { features = [ "docs" ], solve-group = "default" }
metal = { features = [ "metal" ], solve-group = "metal" }
tests-cpu = { features = [ "tests" ], solve-group = "default" }
tests-cuda12 = { features = [ "tests", "cuda12" ], solve-group = "cuda12" }
tests-cuda13 = { features = [ "tests", "cuda13" ], solve-group = "cuda13" }
tests-metal = { features = [ "tests", "metal" ], solve-group = "metal" }
type-checking = { features = [ "type-checking", "tests" ], solve-group = "default" }
[tool.pixi.feature.cuda12]
platforms = [ "linux-64" ]
system-requirements = { cuda = "12" }
[tool.pixi.feature.cuda12.target.linux-64.dependencies]
cuda-nvcc = "~=12.0"
[tool.pixi.feature.cuda12.target.linux-64.pypi-dependencies]
jax = { version = ">=0.9", extras = [ "cuda12" ] }
[tool.pixi.feature.cuda13]
platforms = [ "linux-64" ]
system-requirements = { cuda = "13" }
[tool.pixi.feature.cuda13.target.linux-64.dependencies]
cuda-nvcc = "~=13.0"
[tool.pixi.feature.cuda13.target.linux-64.pypi-dependencies]
jax = { version = ">=0.9", extras = [ "cuda13" ] }
[tool.pixi.feature.docs.dependencies]
jupyter-book = ">=2.0"
mystmd = "*"
[tool.pixi.feature.docs.pypi-dependencies]
quantecon = "*"
[tool.pixi.feature.docs.tasks]
build-docs = { cmd = "jupyter book build --html --execute", cwd = "docs", env = { JAX_PLATFORMS = "cpu" } }
explanation-notebooks = "jupyter execute docs/explanations/*.ipynb"
view-docs = { cmd = "jupyter book start --execute", cwd = "docs", env = { JAX_PLATFORMS = "cpu" } }
[tool.pixi.feature.metal]
platforms = [ "osx-arm64" ]
[tool.pixi.feature.metal.target.osx-arm64.pypi-dependencies]
jax = ">=0.9"
jax-metal = ">=0.1.1"
[tool.pixi.feature.tests.dependencies]
pytest = "*"
pytest-cov = "*"
pytest-xdist = "*"
[tool.pixi.feature.tests.pypi-dependencies]
quantecon = "*"
[tool.pixi.feature.tests.tasks]
tests = "pytest tests"
tests-32bit = "pytest tests --precision=32"
tests-with-cov = "pytest tests --cov-report=xml --cov=./"
[tool.pixi.feature.type-checking.dependencies]
matplotlib = "*"
pandas-stubs = "*"
scipy-stubs = "*"
ty = "*"
[tool.pixi.feature.type-checking.tasks]
ty = "ty check"
[tool.pixi.pypi-dependencies]
jax = ">=0.9"
pdbp = "*"
pylcm = { path = ".", editable = true }
[tool.pixi.tasks]
asv-compare = "asv compare"
asv-preview = "asv preview"
asv-pr-comment = "python benchmarks/pr_comment.py"
asv-publish = "python benchmarks/publish.py"
asv-quick = { cmd = "asv run --quick --set-commit-hash=$(git rev-parse HEAD)", env = { XLA_PYTHON_CLIENT_MEM_FRACTION = "0.3" } }
asv-run = { cmd = 'git status --porcelain --ignore-submodules | grep -q . && echo "Refusing to benchmark: worktree is dirty. Commit first." && exit 1; asv run --set-commit-hash=$(git rev-parse HEAD)', env = { XLA_PYTHON_CLIENT_MEM_FRACTION = "0.3" } }
asv-run-and-pr-comment = { depends-on = [ "asv-run", "asv-pr-comment" ] }
asv-run-and-publish-main = { depends-on = [ "asv-run", "asv-publish" ] }
[tool.pixi.workspace]
channels = [ "conda-forge" ]
platforms = [ "linux-64", "osx-arm64", "win-64" ]
[tool.ruff]
target-version = "py314"
exclude = [ "src/lcm/sandbox" ]
fix = true
unsafe-fixes = false
[tool.ruff.lint]
select = [ "ALL" ]
extend-ignore = [
"COM812", # Conflicts with ruff-format
"D", # Docstrings
"EM101", # Exception must not use a string literal
"EM102", # Exception must not use an f-string literal
"FIX002", # Line contains TODO
"ISC001", # Conflicts with ruff-format
"N802", # Function name should be lowercase
"N803", # Argument name should be lowercase
"N806", # Variable in function should be lowercase
"N815", # Variable in class scope should not be mixedCase
"PLR0913", # Too many arguments in function definition
"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
"TRY003", # Long messages outside exception class
"UP047", # Generic function should use type parameters
"F722", # https://docs.kidger.site/jaxtyping/faq/#flake8-or-ruff-are-throwing-an-error
]
per-file-ignores."benchmarks/*" = [
"ANN", # Annotations
"ARG002", # Unused method argument (ASV passes params to all methods)
"BLE001", # Blind exception
"D", # Docstrings
"INP001", # Implicit namespace package
"PLC0415", # import not at top level
"PLR2004", # Magic values in comparison
"PLW1510", # subprocess.run without explicit check
"RUF012", # Mutable class attribute (ASV requires list `params`/`param_names`)
"S101", # Use of assert
"SIM108", # Ternary operator
"S603", # subprocess call without shell=True check
"S607", # Partial executable path
"T201", # print found
]
per-file-ignores."docs/**/*" = [
"ANN001", # Missing type annotation for function argument
"ANN002", # Missing type annotation for *args
"ANN003", # Missing type annotation for **kwargs
"ANN201", # Missing return type annotation for public function
"ANN202", # Missing return type annotation for private function
"ARG001", # Unused function argument
"D100", # Missing docstring in public module
"D103", # Missing docstring in public function
"D104", # Missing docstring in public package
"PD011", # Use `.to_numpy()` — false positive on JAX .values
"S101", # Use of assert
"RUF001", # Ambiguous Unicode characters (Greek letters in plot titles)
"T201", # print found
"T203", # pprint found
]
per-file-ignores."explanations/*" = [
"ANN", # Annotations
"E402", # Module level import not at top of file
"INP001", # Implicit namespace package
"T201", # print found
"T203", # pprint found
]
per-file-ignores."src/lcm/utils/functools.py" = [
"ANN401", # Dynamically typed expressions (Any)
]
per-file-ignores."src/lcm/**/*[A-Z]*.py" = [
"N999", # Module name mixing uppercase and lowercase (Q_and_F.py, V.py, max_Q_over_a.py)
]
per-file-ignores."tests/*" = [
"ANN", # Annotations
"D", # Docstrings
"INP001", # Implicit namespace package
"N999", # Module name mixing uppercase and lowercase
"PLR2004", # Magic values in comparison
"S101", # Use of assert
"S301", # Use of pickle
"SLF001", # Private member access
]
per-file-ignores."tests/test_next_state.py" = [
"ARG001", # Unused function argument
"ARG005", # Unused lambda argument
"E731", # Do not assign a `lambda` expression, use a `def`
]
per-file-ignores."tests/test_Q_and_F.py" = [
"ARG001", # Unused function argument
"ARG005", # Unused lambda argument
"E731", # Do not assign a `lambda` expression, use a `def`
]
pydocstyle.convention = "google"
[tool.ruff.lint.flake8-bugbear]
extend-immutable-calls = [ "lcm.utils.containers.Unset", "Unset" ]
[tool.pyproject-fmt]
column_width = 88
max_supported_python = "3.14"
table_format = "long"
collapse_tables = [ "tool.hatch", "tool.pytest", "tool.pytask", "tool.ty" ]
expand_tables = [
"tool.pixi.dependencies",
"tool.pixi.environments",
"tool.pixi.feature.tests.pypi-dependencies",
"tool.pixi.feature.tests.tasks",
"tool.pixi.feature.type-checking.dependencies",
"tool.pixi.feature.type-checking.tasks",
"tool.pixi.pypi-dependencies",
"tool.pixi.tasks",
"tool.pixi.workspace",
]
[tool.ty]
rules.ambiguous-protocol-member = "error"
rules.deprecated = "error"
rules.division-by-zero = "error"
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.redundant-cast = "error"
rules.unused-awaitable = "error"
rules.unused-ignore-comment = "error"
src.exclude = [ "docs/**/*.ipynb" ]
src.include = [ "src/", "tests/" ]
[tool.pytest]
ini_options.addopts = [
"--pdbcls=pdbp:Pdb",
"--dist",
"loadfile",
]
ini_options.filterwarnings = []
ini_options.markers = [
"illustrative: Tests are designed for illustrative purposes",
"gpu: Tests that require a GPU (skipped on CPU-only machines)",
]
ini_options.norecursedirs = [ "docs" ]
[tool.yamlfix]
line_length = 88
none_representation = "null"
sequence_style = "block_style"