Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
420 lines (389 loc) · 13.3 KB
/
Copy pathpyproject.toml
File metadata and controls
420 lines (389 loc) · 13.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
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
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
[build-system]
build-backend = "hatchling.build"
requires = ["hatchling>=1.18"]
[dependency-groups]
dev = [
"bandit[toml]>=1.8.6",
"pre-commit>=4.6",
"hypothesis>=6.156.6",
"import-linter>=2.5",
"interrogate>=1.7.0",
"nbqa>=1.9.1",
"pylint>=3.3.8",
"pytest-json-report>=1.5.0",
"pytest-randomly>=3.16.0",
"radon>=6.0.1",
"scikit-learn>=1.8.0"
]
[project]
authors = [{name = "Mahdi Shafiei"}]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Bio-Informatics",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Software Development",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Libraries :: Python Modules",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"License :: OSI Approved :: MIT License"
]
dependencies = [
# Datarax - operator, source, and pipeline contracts
"datarax>=0.1.14",
# Artifex - modeling, modality, and transformer substrate
"avitai-artifex>=0.1.12",
# Opifex - scientific ML, operator learning, and advanced optimization
"opifex>=0.2.8",
# Calibrax - benchmarking, comparison, profiling, and regression control
"calibrax>=0.1.9",
# Substrax - device identity, meshes, runtime settings and checkpoint store shared by the
# siblings; 0.1.6 adds substrax.runtime, substrax.artifacts and substrax.testing.
"substrax>=0.1.11",
# JAX ecosystem
"beartype>=0.14.1",
"chex>=0.1.7",
"flax>=0.12.9",
"jax>=0.11.1",
"jaxtyping>=0.2.20",
# 0.2.8 stopped setting jax_pmap_shmap_merge, which jax removed in 0.10; below it,
# importing flax raises AttributeError and collection dies for the whole suite.
"optax>=0.2.8",
# Scientific computing
"numpy>=1.24",
"scipy>=1.10",
# Bioinformatics
"biopython>=1.81",
"anndata>=0.9.1",
"h5py>=3.7",
"jax-md>=0.2.27"
]
description = "End-to-end differentiable bioinformatics for JAX/Flax NNX: alignment, mapping, assembly, variant calling, RNA-seq, single-cell, epigenomics, CRISPR, metabolomics, multi-omics, protein and RNA structure, molecular dynamics and drug-discovery operators composed into trainable pipelines on datarax, artifex, opifex and calibrax"
keywords = ["jax", "flax", "bioinformatics", "differentiable", "variant-calling", "alignment", "machine-learning"]
license = {file = "LICENSE"}
name = "diffbio"
readme = "README.md"
requires-python = ">=3.12,<3.14"
version = "0.1.9"
[project.optional-dependencies]
all = ["diffbio[benchmark,chem,cuda12,dev,docs,genomics,metal,soft-ops-advanced,soft-ops-ot,test,torch-io]"]
benchmark = [
# benchmarks/crossmodality/*.py call datasets.load_dataset. It used to arrive
# transitively through the sibling packages; they now declare their heavy
# dependencies behind extras, so what these scripts use is declared here.
"datasets>=2.14",
"scib-metrics>=0.5",
"pynndescent>=0.5",
"squidpy>=1.4",
"tabulate>=0.9",
"deepchem>=2.8.0",
"pandas>=2.0",
"matplotlib>=3.7"
]
# RDKit, for the molecular-graph and fingerprint operators. Every call site imports it
# lazily, so the rest of diffbio installs and runs without it.
chem = ["rdkit>=2025.9.3"]
cuda-dev = ["diffbio[cuda12,dev]"]
# Named for the CUDA major version, as JAX names its own extras (cuda12, cuda12-local,
# cuda13); JAX publishes no `gpu` extra. No jaxlib line: every jax cuda extra already
# requires jaxlib<=X,>=X at its own version, so restating it only lets the two disagree.
cuda12 = ["jax[cuda12]>=0.11.1"]
dev = [
"bandit[toml]>=1.8.6",
"build>=1.0.3",
"coverage>=7",
"flake8>=7.0",
"flake8-functions-names>=0.4",
"import-linter>=2.5",
"ipykernel>=6.29.5",
"interrogate>=1.7.0",
"pylint>=3.3.8",
"pyright>=1.1.336",
"pytest>=8.3.5",
"pytest-asyncio>=0.23",
"pytest-benchmark>=4",
"pytest-cov>=6.1.1",
"pytest-env>=1.0.1",
"pytest-randomly>=3.16.0",
"pytest-timeout>=2.1",
"pytest-xdist>=3.6",
"radon>=6.0.1",
"shellcheck-py>=0.10.0.1",
"python-dotenv>=1",
"ruff>=0.1.5",
"pytest-json-report>=1.5.0",
"wemake-python-styleguide>=1.0"
]
docs = [
"griffe>=1.7.3",
"mkdocs>=1.6.1",
"mkdocs-include-exclude-files>=0.1",
"mkdocs-material>=9.6.7",
"mkdocstrings>=0.28.3",
"mkdocstrings-python>=1.1.2",
"pymdown-extensions>=10.14.3"
]
genomics = ["pysam>=0.22.0", "pyfaidx>=0.8.0"]
# Apple Silicon GPU backend; setup.sh selects it on arm64 macOS.
metal = ["jax-metal>=0.1.0; sys_platform == 'darwin' and platform_machine == 'arm64'"]
soft-ops-advanced = ["optimistix>=0.0.9", "lineax>=0.0.8"]
soft-ops-ot = ["diffbio[soft-ops-advanced]", "ott-jax>=0.5.0"]
test = [
"beartype>=0.14.1",
"coverage>=7",
"pytest>=8.3.5",
"pytest-asyncio>=0.23",
"pytest-benchmark>=4",
"pytest-cov>=6.1.1",
"pytest-env>=1.0.1",
"pytest-randomly>=3.16.0",
"pytest-timeout>=2.1",
"pytest-xdist>=3.6",
# tests/test_ci_shards.py reads the CI workflow.
"pyyaml>=6"
]
torch-io = ["torch>=1.13.0"]
[project.urls]
"Bug Tracker" = "https://github.com/avitai/DiffBio/issues"
Documentation = "https://diffbio.readthedocs.io"
Source = "https://github.com/avitai/DiffBio"
[tool.bandit]
exclude_dirs = ["tests", "scripts", "examples", "memory-bank", ".deprecated", ".venv"]
skips = ["B101", "B110"]
[tool.coverage.html]
directory = "htmlcov"
skip_covered = false
skip_empty = false
[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",
"pass",
"raise ImportError"
]
fail_under = 80
precision = 2
show_missing = true
skip_covered = false
[tool.coverage.run]
branch = true
omit = ["*/tests/*", "*/conftest.py", "*/__pycache__/*", "*/scripts/*", "*/examples/*", "*/memory-bank/*"]
parallel = true
source = ["src"]
[tool.coverage.xml]
output = "coverage.xml"
[tool.hatch.build.targets.sdist]
include = ["src/diffbio", "README.md", "LICENSE", "pyproject.toml"]
[tool.hatch.build.targets.wheel]
packages = ["src/diffbio"]
[tool.hatch.metadata]
allow-direct-references = true
[tool.importlinter]
root_package = "diffbio"
[[tool.importlinter.contracts]]
forbidden_modules = ["diffbio.operators", "diffbio.pipelines", "diffbio.sources", "diffbio.splitters"]
name = "Core must not import high-level modules"
source_modules = ["diffbio.core"]
type = "forbidden"
[[tool.importlinter.contracts]]
forbidden_modules = ["diffbio.pipelines"]
name = "Operators must not import pipelines"
source_modules = ["diffbio.operators"]
type = "forbidden"
[[tool.importlinter.contracts]]
forbidden_modules = ["diffbio.operators", "diffbio.pipelines"]
name = "Sources must not import operators or pipelines"
source_modules = ["diffbio.sources"]
type = "forbidden"
[[tool.importlinter.contracts]]
forbidden_modules = ["diffbio.operators", "diffbio.pipelines"]
name = "Splitters must not import operators or pipelines"
source_modules = ["diffbio.splitters"]
type = "forbidden"
[[tool.importlinter.contracts]]
forbidden_modules = ["diffbio.operators", "diffbio.pipelines"]
name = "Samplers must not import operators or pipelines"
source_modules = ["diffbio.samplers"]
type = "forbidden"
[[tool.importlinter.contracts]]
forbidden_modules = ["diffbio.pipelines"]
name = "Lower layers must not import pipelines"
source_modules = [
"diffbio.core",
"diffbio.losses",
"diffbio.operators",
"diffbio.samplers",
"diffbio.sequences",
"diffbio.sources",
"diffbio.splitters",
"diffbio.utils"
]
type = "forbidden"
[tool.interrogate]
exclude = ["tests", "examples", "memory-bank", "scripts", ".deprecated"]
fail-under = 80
ignore-init-method = true
ignore-init-module = true
ignore-magic = true
ignore-module = true
quiet = false
[tool.pydocstyle]
add-ignore = ["D100", "D104", "D105", "D107", "D202", "D212", "D415"]
convention = "google"
match = ".*\\.py$"
match-dir = "^(?!tests|examples).*"
[tool.pyright]
exclude = ["docs", "examples", "scripts", ".deprecated", "**/__pycache__", "**/.venv", "memory-bank"]
extraPaths = ["."]
include = ["src", "tests"]
pythonVersion = "3.12"
reportAbstractUsage = false
reportArgumentType = "warning"
reportAssignmentType = false
reportAttributeAccessIssue = false
reportCallIssue = "warning"
reportFunctionMemberAccess = false
reportGeneralTypeIssues = false
reportIncompatibleMethodOverride = false
reportIncompatibleVariableOverride = false
reportIndexIssue = false
reportOperatorIssue = false
reportOptionalCall = false
reportOptionalIterable = false
reportOptionalMemberAccess = false
reportOptionalOperand = false
reportOptionalSubscript = false
reportPossiblyUnboundVariable = false
reportReturnType = "warning"
reportUnusedExpression = false
venv = ".venv"
venvPath = "."
[tool.pytest.ini_options]
addopts = "--strict-markers --strict-config --verbose --tb=short --color=yes --durations=10 --cov=src/ --cov-report=term-missing --cov-report=html --cov-fail-under=80 --timeout=300 --json-report --json-report-file=temp/test-results.json --json-report-indent=2"
cache_dir = ".pytest_cache"
console_output_style = "progress"
filterwarnings = [
"ignore::DeprecationWarning:pkg_resources.*",
"ignore::DeprecationWarning:jax.*",
"ignore:jax.interpreters.xla.pytype_aval_mappings is deprecated:DeprecationWarning",
"ignore::UserWarning:jax._src.xla_bridge",
"ignore:.*cuSPARSE.*",
"ignore:.*CUDA-enabled jaxlib.*",
"ignore:Sharding info not provided when restoring.*:UserWarning:orbax.*",
"ignore:Sharding info not provided when restoring.*:UserWarning",
"ignore:'.type' is deprecated:DeprecationWarning",
"ignore:unclosed <socket.socket.*:ResourceWarning",
"ignore:unclosed event loop.*:ResourceWarning",
"ignore::ResourceWarning"
]
log_cli = true
log_cli_level = "INFO"
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
"gpu: marks tests that require GPU (deselect with '-m \"not gpu\"')",
"gpu_required: marks tests as requiring GPU (will fail if GPU unavailable)",
"cuda: marks tests that specifically test CUDA functionality",
"cpu: marks tests that should run on CPU only",
"integration: marks tests as integration tests",
"unit: marks tests as unit tests",
"benchmark: marks tests as performance benchmarks",
"e2e: marks tests as end-to-end tests",
"performance: marks tests as performance tests",
"network: marks tests that require network access (deselect with '-m \"not network\"')",
"scbench: marks tests using scBench single-cell benchmark problems",
"spatialbench: marks tests using SpatialBench spatial transcriptomics benchmark problems"
]
minversion = "6.0"
python_classes = "Test*"
python_files = "test_*.py"
python_functions = "test_*"
testpaths = ["tests"]
[tool.pytest-benchmark]
compare = ["last", "base"]
disable_gc = true
histogram = "histogram.svg"
min_rounds = 5
min_time = 0.1
save = "benchmark-results"
save_data = true
warmup = true
warmup_iterations = 3
[tool.pytest_env]
JAX_ENABLE_X64 = "0"
JAX_SKIP_CUDA_CONSTRAINTS_CHECK = "1"
LD_LIBRARY_PATH = "/usr/local/cuda/lib64"
XLA_PYTHON_CLIENT_MEM_FRACTION = "0.75"
XLA_PYTHON_CLIENT_PREALLOCATE = "false"
[tool.ruff]
exclude = ["memory-bank", ".deprecated", "examples", ".venv"]
extend-include = ["*.ipynb"]
line-length = 100
src = ["src"]
target-version = "py312"
[tool.ruff.format]
indent-style = "space"
line-ending = "auto"
quote-style = "double"
skip-magic-trailing-comma = false
[tool.ruff.lint]
fixable = ["I001", "F401", "E", "W", "W291", "W292", "W293", "F841"]
ignore = [
"E402",
"E721",
"E731",
"E741",
"F722",
"F821", # Undefined names in jaxtyping dimension annotations
"W391",
"E203",
"UP006",
"UP007",
"UP015",
"UP024",
"UP035",
# PEP 695 generic syntax (`def f[T]`, `class C[T]`). Enabled by target-version py312, but
# the docstring gate is pydocstyle 6.3.0, whose parser predates PEP 695: it reports D101 /
# D103 "missing docstring" for generic functions, and for generic classes with a bound, on
# definitions whose docstring is plainly present. 6.3.0 is its final release (2023-01-17),
# so no version of it reads this syntax. Re-enable these together with replacing pydocstyle
# with ruff's own D rules, which parse it correctly.
"UP046", # Generic class uses Generic subclass instead of type parameters
"UP047", # Generic function should use type parameters
"UP049", # Private type parameter name
"RUF005"
]
select = ["E", "F", "UP"]
[tool.ruff.lint.isort]
combine-as-imports = true
extra-standard-library = []
known-first-party = ["diffbio"]
lines-after-imports = 2
order-by-type = false
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.uv]
# Security floors for vulnerable transitive dependencies that have a published fix.
# setuptools arrives through torch, tensorflow and tensorboard, which require it at
# runtime; it is not this project's build backend, which is hatchling.
constraint-dependencies = [
# dm-haiku arrives through jax-md. Up to 0.0.16 it does
# `DropVar: TypeAlias = jax.core.DropVar` at import time, and jax removed jax.core.DropVar
# in 0.11.0, so importing diffbio.operators.molecular_dynamics dies with AttributeError.
# 0.0.17 guards it with a try/except onto jax.extend.core.
"dm-haiku>=0.0.17",
"setuptools>=83.0.0" # PYSEC-2026-3447
]
python-preference = "only-managed"