Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
242 lines (219 loc) · 7.11 KB
/
Copy pathpyproject.toml
File metadata and controls
242 lines (219 loc) · 7.11 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
[project]
authors = [{ name = "McCoy Becker", email = "mccoyb@mit.edu" }]
name = "genjax"
description = "Vectorized probabilistic programming with generative functions and programmable inference in JAX"
license = "Apache-2.0"
license-files = ["LICENSE.md"]
keywords = [
"probabilistic programming",
"programmable inference",
"Bayesian inference",
"JAX",
"Monte Carlo",
"variational inference",
]
requires-python = ">= 3.12"
version = "1.0.14"
dynamic = ["readme"]
dependencies = [
"penzai>=0.2.5,<0.3",
"beartype>=0.22.9,<0.23",
"jax>=0.11.1,<0.12",
"jaxtyping>=0.3.11,<0.4",
"tfp-nightly==0.26.0.dev20260831",
]
[project.optional-dependencies]
viz = ["matplotlib>=3.11.1,<4"]
[project.urls]
Homepage = "https://github.com/a-tiny-project/genjax"
Repository = "https://github.com/a-tiny-project/genjax"
Paper = "https://doi.org/10.1145/3776729"
Artifact = "https://doi.org/10.5281/zenodo.17342547"
[build-system]
build-backend = "hatchling.build"
requires = ["hatchling>=1.32,<2", "hatch-fancy-pypi-readme>=25.1,<26"]
# The source distribution carries the package, its tests, and the examples
# two tests import. uv.lock and raster assets stay in the repository.
[tool.hatch.build.targets.sdist]
include = ["src/genjax", "tests", "examples", "CITATION.cff", "README.md"]
exclude = ["examples/**/assets"]
# PyPI resolves relative links against the project page, so the built
# description points each one at the file on GitHub. GitHub redirects the
# blob URL of a directory to its tree URL.
[tool.hatch.metadata.hooks.fancy-pypi-readme]
content-type = "text/markdown"
[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
path = "README.md"
[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
pattern = '\]\((?!https?://|mailto:|#)([^)\s]+)\)'
replacement = '](https://github.com/a-tiny-project/genjax/blob/main/\1)'
[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
pattern = 'src="logo\.svg"'
replacement = 'src="https://raw.githubusercontent.com/a-tiny-project/genjax/main/logo.png"'
[tool.vulture]
make_whitelist = true
min_confidence = 80
paths = ["src"]
sort_by_size = true
[tool.uv]
environments = [
"sys_platform == 'linux' and platform_machine == 'x86_64'",
"sys_platform == 'darwin' and platform_machine == 'arm64'",
]
[tool.uv.dependency-groups]
cuda = { requires-python = ">=3.12,<3.14" }
perfbench-pyro = { requires-python = ">=3.12,<3.14" }
perfbench-torch = { requires-python = ">=3.12,<3.14" }
[tool.uv.sources]
torch = [
{ index = "pytorch-cu129", marker = "sys_platform == 'linux' and platform_machine == 'x86_64'" },
{ index = "pytorch-cpu", marker = "sys_platform == 'darwin' and platform_machine == 'arm64'" },
]
torchvision = [
{ index = "pytorch-cu129", marker = "sys_platform == 'linux' and platform_machine == 'x86_64'" },
{ index = "pytorch-cpu", marker = "sys_platform == 'darwin' and platform_machine == 'arm64'" },
]
[[tool.uv.index]]
name = "pytorch-cu129"
url = "https://download.pytorch.org/whl/cu129"
explicit = true
[[tool.uv.index]]
name = "pytorch-cpu"
url = "https://download.pytorch.org/whl/cpu"
explicit = true
[dependency-groups]
format = ["ruff==0.16.5", "vulture>=2.16,<3", "pre-commit>=4.6.2,<5"]
test = [
"matplotlib>=3.11.1,<4",
"pytest>=9.1.1,<10",
"pytest-cov>=7.1.0,<8",
"coverage>=7.16.0,<8",
"xdoctest>=1.3.2,<2",
"pytest-xdist>=3.8.0,<4",
"pytest-benchmark>=5.3.0,<6",
]
cuda = ["jax[cuda12]>=0.11.1,<0.12; sys_platform == 'linux'"]
faircoin = [
"matplotlib>=3.11.1,<4",
"seaborn>=0.13.2,<0.14",
"numpyro>=0.21,<0.22",
]
curvefit = [
"matplotlib>=3.11.1,<4",
"numpy>=2.5,<3",
"pygments>=2.21,<3",
"seaborn>=0.13.2,<0.14",
"numpyro>=0.21,<0.22",
"funsor>=0.4.8,<0.5",
]
gol = ["matplotlib>=3.11.1,<4"]
localization = [
"matplotlib>=3.11.1,<4",
"seaborn>=0.13.2,<0.14",
"ptitprince>=0.3.1,<0.4",
]
perfbench = [
"numpy>=2.5,<3",
"matplotlib>=3.11.1,<4",
"seaborn>=0.13.2,<0.14",
"pandas>=3.0,<4",
"scipy>=1.18,<2",
"numpyro>=0.21,<0.22",
]
perfbench-pyro = [
{ include-group = "perfbench" },
"pyro-ppl>=1.9.1,<2",
"torch>=2.13,<2.14",
"torchvision>=0.28,<0.29",
]
perfbench-torch = [{ include-group = "perfbench" }, "torch>=2.13,<2.14"]
[tool.ruff]
extend-exclude = ["*.md"]
[tool.ruff.lint]
select = ["E4", "E7", "E9", "F"]
[tool.coverage.run]
source = ["src"]
omit = ["*/tests/*", "*/examples/*"]
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"if self.debug:",
"if settings.DEBUG",
"raise AssertionError",
"raise NotImplementedError",
"if 0:",
"if __name__ == .__main__.:",
"class .*\\bProtocol\\):",
"@(abc\\.)?abstractmethod",
]
[tool.pytest.ini_options]
minversion = "8.0"
addopts = [
"-ra", # Show short test summary for all results
"--strict-markers", # Require all markers to be defined
"--strict-config", # Strict configuration parsing
"--cov=src/genjax", # Coverage for source code
"--cov-report=term-missing", # Show missing lines in terminal
"--cov-report=html", # Generate HTML coverage report
"--cov-report=xml", # Generate XML coverage for CI
]
testpaths = ["tests"]
pythonpath = ["."]
python_files = ["test_*.py", "*_test.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
markers = [
"slow: marks tests as slow (taking >5 seconds)",
"fast: marks tests as fast (taking <1 second)",
"integration: marks tests as integration tests (cross-component)",
"unit: marks tests as unit tests (single component)",
"regression: marks tests as regression tests (bug prevention)",
"adev: marks tests for ADEV gradient estimators",
"smc: marks tests for Sequential Monte Carlo",
"mcmc: marks tests for Markov Chain Monte Carlo",
"vi: marks tests for Variational Inference",
"hmm: marks tests for Hidden Markov Models",
"core: marks tests for core GenJAX functionality",
"pjax: marks tests for PJAX (Probabilistic JAX) functionality",
"distributions: marks tests for probability distributions",
"tfp: marks tests requiring TensorFlow Probability",
"requires_gpu: marks tests that need GPU acceleration",
"benchmark: marks tests that should be benchmarked",
]
filterwarnings = [
"ignore::DeprecationWarning:jax.*",
"ignore::DeprecationWarning:tensorflow_probability.*",
"error::UserWarning", # Turn UserWarnings into errors to catch issues
]
[tool.pytest-benchmark]
# Configuration for pytest-benchmark
min_rounds = 3 # Minimum number of benchmark rounds
max_time = 10.0 # Maximum time per benchmark (seconds)
min_time = 0.01 # Minimum time per round (seconds)
timer = "time.perf_counter" # High-resolution timer
disable_gc = true # Disable garbage collection during benchmarks
sort = "mean" # Sort results by mean time
columns = [
"min",
"max",
"mean",
"stddev",
"median",
"iqr",
"outliers",
"ops",
"rounds",
]
histogram = true # Generate histogram data
save = ".benchmarks/benchmarks.json" # Save results to file
save_data = true # Save benchmark data
autosave = true # Automatically save results
[tool.xdoctest]
# Configure xdoctest for running doctests
modname = "genjax"
command = "list"
verbose = 2
durations = 10
style = "google"
options = "+ELLIPSIS"