-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
155 lines (141 loc) · 5.31 KB
/
Copy pathpyproject.toml
File metadata and controls
155 lines (141 loc) · 5.31 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
[project]
name = "mechdsl-workspace"
version = "0.2.1"
description = "MechDSL monorepo — LaTeX-to-FEM compiler + algorithm transpiler"
license = "MIT"
license-files = ["LICENSE"]
requires-python = ">=3.11,<3.14"
dependencies = [
"markdown>=3.10.2",
"numpy>=2.4.2",
"python-fasthtml>=0.12.42",
]
# ---------- uv workspace ----------
[tool.uv.workspace]
members = ["packages/*"]
[tool.uv]
# Supply-chain safety: ignore any package version uploaded after this date.
# This blocks compromised releases from the recent pip/npm supply-chain attacks.
# Bump this date intentionally (and audit the diff in uv.lock) when upgrading deps.
exclude-newer = "2026-02-20T00:00:00Z"
# Dev dependencies shared across all workspace members
# (migrated from deprecated [tool.uv] dev-dependencies)
[dependency-groups]
dev = [
"pytest>=9.0.2",
"pytest-cov>=7.0.0",
"mypy>=1.11",
"ruff>=0.7",
"pre-commit>=3.5",
]
docs = [
"mkdocs-material>=9.7.2",
]
# ---------- shared tool config ----------
[tool.pytest.ini_options]
testpaths = [
"packages/mechdsl-core/tests",
"packages/algo2code/tests",
"packages/ti-runtime/tests",
]
cache_dir = ".pytest_cache"
addopts = [
"-ra",
"--strict-markers",
"--tb=short",
"--import-mode=importlib",
]
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
"gpu: marks tests that require a GPU",
"e2e: end-to-end pipeline tests",
"audit: verification audit tests mapping spec IDs to implementations",
"benchmark: FLOP-count / performance regression tests (no wall-clock timing)",
"integration: integration tests spanning multiple modules or subsystems",
"unit: focused unit tests for a single function or class",
"regression: regression tests guarding against semantic changes in refactors",
"nightly: Phase 10 benchmark tests — run in nightly CI only, not in the fast tier",
"stable_backend: tests guarding the MVP-stable Taichi codegen contract — must pass on every push",
"experimental_backend: tests exercising experimental backends (MFEM/MOOSE) — may xfail/skip without blocking the stable contract",
"from_latex: tests that exercise the canonical compile_latex(...) entry point starting from a LaTeX source string",
"from_problem_ir: tests that construct ProblemIR programmatically (build_context() / direct ProblemIR(...)); secondary contract surface per P2-2",
"docs: documentation-anchor / doc-tier tests",
]
[tool.ruff]
target-version = "py312"
line-length = 100
src = [
"packages/mechdsl-core/src",
"packages/algo2code/src",
"packages/ti-runtime/src",
]
exclude = [
"packages/algo2code/prototypes",
".claude/worktrees",
"mvp_concept_demo",
# Generated FEM solver artifacts — emitted by the codegen pipeline, not
# hand-maintained source. Linting/formatting them would fight the printer.
"dev/examples/_output",
]
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"UP", # pyupgrade
"B", # flake8-bugbear
"SIM", # flake8-simplify
"TCH", # flake8-type-checking
"RUF", # ruff-specific rules
]
ignore = [
"E501", # line too long (handled by formatter)
"B008", # do not perform function call in argument defaults
# Physics/mechanics codebase: Greek letters (σ, ρ, μ), ×/−/– in
# dimensions and math notation, and uppercase `I` as material index
# (per dev/design_docs/07-CONVENTIONS.md) are intentional domain
# notation — not typos.
"RUF001", # ambiguous unicode in strings
"RUF002", # ambiguous unicode in docstrings
"RUF003", # ambiguous unicode in comments
"E741", # ambiguous variable name (collides with index convention)
]
[tool.ruff.lint.per-file-ignores]
# FastHTML's public API is exposed exclusively through a star import
# (`from fasthtml.common import *`) — `fast_app`, `Div`, `Button`, `serve`,
# etc. are all re-exported this way. Explicit imports would fight the
# framework's intended usage, so scope the star-import warnings to this script.
"scripts/report.py" = ["F403", "F405"]
[tool.ruff.lint.isort]
known-first-party = ["mechdsl", "algo2code", "ti_runtime"]
[tool.mypy]
python_version = "3.12"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = false
check_untyped_defs = true
ignore_missing_imports = true
mypy_path = "packages/mechdsl-core/src:packages/algo2code/src:packages/ti-runtime/src"
[[tool.mypy.overrides]]
module = "tests.*"
disallow_untyped_defs = false
# ti-runtime is Taichi DSL code: `@ti.kernel`/`@ti.func` signatures use runtime
# markers (`ti.template()`, `ti.f64`) and Taichi-typed matrix/vector ops that are
# not statically checkable by mypy — Taichi's own compiler verifies them at JIT.
[[tool.mypy.overrides]]
module = ["ti_runtime", "ti_runtime.*"]
ignore_errors = true
# Physics numerics: numpy operations propagate as Any through ndarray-typed
# returns, tripping warn_return_any with no actionable bug. Suppress for the
# known-pure-numpy modules only; the rest of the tree keeps strict returns.
[[tool.mypy.overrides]]
module = [
"mechdsl.symbolic.convected",
"mechdsl.symbolic.models.neo_hookean",
"mechdsl.symbolic.models.mooney_rivlin",
"mechdsl.symbolic.models.hgo",
"mechdsl.codegen.hourglass",
"mechdsl.verify.ad_oracle",
]
warn_return_any = false