Skip to content

Commit 6f0c277

Browse files
authored
FIX: determine numerical algorithm correctly (#501)
* DX: add `poe upgrade` task * DX: group Poe the Poet tasks * MAINT: add type hints for `Printer` * MAINT: implement updates from auto-formatters * MAINT: upgrade lock files
1 parent 9900bb8 commit 6f0c277

12 files changed

Lines changed: 1127 additions & 914 deletions

File tree

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ repos:
1414
- id: check-useless-excludes
1515

1616
- repo: https://github.com/ComPWA/policy
17-
rev: 0.8.9
17+
rev: 0.8.13
1818
hooks:
1919
- id: check-dev-files
2020
args:
@@ -59,7 +59,7 @@ repos:
5959
metadata.vscode
6060
6161
- repo: https://github.com/astral-sh/ruff-pre-commit
62-
rev: v0.15.10
62+
rev: v0.15.16
6363
hooks:
6464
- id: ruff-check
6565
args: [--fix]
@@ -113,7 +113,7 @@ repos:
113113
- --in-place
114114

115115
- repo: https://github.com/python-jsonschema/check-jsonschema
116-
rev: 0.37.1
116+
rev: 0.37.2
117117
hooks:
118118
- id: check-jsonschema
119119
name: Check CITATION.cff
@@ -153,6 +153,6 @@ repos:
153153
types_or: [python, pyi, jupyter]
154154

155155
- repo: https://github.com/astral-sh/uv-pre-commit
156-
rev: 0.11.6
156+
rev: 0.11.19
157157
hooks:
158158
- id: uv-lock

.taplo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ reorder_keys = true
1313

1414
[[rule]]
1515
include = ["**/pyproject.toml"]
16-
keys = ["tool.poe.tasks"]
16+
keys = [
17+
"tool.poe.groups",
18+
"tool.poe.tasks",
19+
]
1720

1821
[rule.formatting]
1922
reorder_arrays = false

docs/analyticity/integration-algorithms.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@
467467
"\n",
468468
"w.jslink((sliders[\"disable_limit\"], \"value\"), (sliders[\"limit\"], \"disabled\"))\n",
469469
"sliders[\"algorithm_name\"].observe(on_algorithm_change, names=\"value\")\n",
470-
"sliders[\"algorithm_name\"].value = \"romberg\" # trigger changes\n",
470+
"sliders[\"algorithm_name\"].value = \"romberg\" # trigger changes # ty:ignore[invalid-assignment]\n",
471471
"timer_box = cast(\"w.ValueWidget\", w.HTML())\n",
472472
"ui = w.VBox([\n",
473473
" tabs := w.Tab([\n",

docs/dynamics.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@
509509
" m0_val = kwargs[\"m0\"]\n",
510510
" thr = kwargs[\"m1\"] + kwargs[\"m2\"]\n",
511511
" if LINES is None:\n",
512-
" LINES = [\n",
512+
" LINES = (\n",
513513
" ax1.plot(x, z.real, label=\"real\")[0],\n",
514514
" ax1.plot(x, z.imag, label=\"imag\")[0],\n",
515515
" ax1.plot(x, np.abs(z) ** 2, label=\"absolute\", c=\"black\", ls=\"dotted\")[0],\n",
@@ -520,7 +520,7 @@
520520
" ax2.axvline(m0_val, c=\"red\", label=f\"${sp.latex(m0)}$\", **style),\n",
521521
" ax1.axvline(thr, c=\"black\", label=f\"${sp.latex(m1 + m2)}$\", **style),\n",
522522
" ax2.axvline(thr, c=\"black\", label=f\"${sp.latex(m1 + m2)}$\", **style),\n",
523-
" ]\n",
523+
" )\n",
524524
" else:\n",
525525
" LINES[0].set_ydata(z.real)\n",
526526
" LINES[1].set_ydata(z.imag)\n",
@@ -585,7 +585,7 @@
585585
"name": "python",
586586
"nbconvert_exporter": "python",
587587
"pygments_lexer": "ipython3",
588-
"version": "3.13.12"
588+
"version": "3.13.13"
589589
}
590590
},
591591
"nbformat": 4,

docs/dynamics/k-matrix.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,7 +1294,7 @@
12941294
"sliders[\"complex_rendering\"] = w.RadioButtons(\n",
12951295
" description=R\"\\(s\\)-plane plot\",\n",
12961296
" options=[\"imag\", \"real\", \"abs\"],\n",
1297-
")\n",
1297+
") # ty:ignore[invalid-assignment]\n",
12981298
"\n",
12991299
"# Create cut-off slider for z-direction\n",
13001300
"sliders[\"z_cutoff\"] = w.FloatSlider(\n",
@@ -1622,7 +1622,7 @@
16221622
" sliders[\"complex_rendering\"] = w.RadioButtons(\n",
16231623
" description=R\"\\(s\\)-plane plot\",\n",
16241624
" options=[\"imag\", \"real\", \"abs\"],\n",
1625-
" )\n",
1625+
" ) # ty:ignore[invalid-assignment]\n",
16261626
"\n",
16271627
" # Create cut-off slider for z-direction\n",
16281628
" sliders[\"z_cutoff\"] = w.FloatSlider(\n",
@@ -1733,7 +1733,7 @@
17331733
"name": "python",
17341734
"nbconvert_exporter": "python",
17351735
"pygments_lexer": "ipython3",
1736-
"version": "3.13.12"
1736+
"version": "3.13.13"
17371737
}
17381738
},
17391739
"nbformat": 4,

pyproject.toml

Lines changed: 92 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -165,49 +165,10 @@ isolated = true
165165
no-group = "dev"
166166
type = "uv"
167167

168-
[tool.poe.tasks.all]
169-
help = "Run all continuous integration (CI) tasks locally"
170-
ignore_fail = "return_non_zero"
171-
sequence = [
172-
"benchmark",
173-
"cov",
174-
"docnb-force",
175-
"linkcheck",
176-
"style",
177-
"test-all",
178-
]
179-
180-
[tool.poe.tasks.benchmark]
181-
cmd = """
182-
pytest benchmarks \
183-
--benchmark-autosave \
184-
--benchmark-json benchmarks/output.json \
185-
--durations=0 \
186-
-k benchmark
187-
"""
188-
executor = {group = "test"}
189-
help = "Run benchmark tests and visualize performance"
190-
191-
[tool.poe.tasks.cov]
192-
cmd = """
193-
pytest \
194-
--cov=ampform \
195-
--cov-fail-under=75 \
196-
--cov-report=html \
197-
--cov-report=xml \
198-
--numprocesses=auto \
199-
${paths}
200-
"""
201-
executor = {group = "test"}
202-
help = "Compute how much of the source code is covered by tests"
203-
204-
[[tool.poe.tasks.cov.args]]
205-
default = "src tests"
206-
multiple = true
207-
name = "paths"
208-
positional = true
168+
[tool.poe.groups.doc]
169+
heading = "Documentation"
209170

210-
[tool.poe.tasks.doc]
171+
[tool.poe.groups.doc.tasks.doc]
211172
cmd = """
212173
sphinx-build \
213174
--builder=html \
@@ -221,7 +182,7 @@ env = {PYTHONWARNINGS = ""}
221182
executor = {group = "doc"}
222183
help = "Build documentation and API"
223184

224-
[tool.poe.tasks.doclive]
185+
[tool.poe.groups.doc.tasks.doclive]
225186
cmd = """
226187
sphinx-autobuild \
227188
--builder=html \
@@ -249,28 +210,17 @@ sphinx-autobuild \
249210
executor = {group = "doc", with = "sphinx-autobuild"}
250211
help = "Set up a server to directly preview changes to the HTML pages"
251212

252-
[tool.poe.tasks.docnb]
213+
[tool.poe.groups.doc.tasks.docnb]
253214
env = {EXECUTE_NB = "yes"}
254215
help = "Build documentation and API with cached notebook execution"
255216
sequence = ["doc"]
256217

257-
[tool.poe.tasks.docnb-force]
258-
env = {FORCE_EXECUTE_NB = "yes"}
259-
help = "Build documentation and API with notebook execution (no cache)"
260-
sequence = ["doc"]
261-
262-
[tool.poe.tasks.docnblive]
218+
[tool.poe.groups.doc.tasks.docnblive]
263219
env = {EXECUTE_NB = "yes"}
264220
help = "Set up a server to directly preview changes to the HTML pages with cached notebook execution"
265221
sequence = ["doclive"]
266222

267-
[tool.poe.tasks.lab]
268-
args = [{name = "paths", default = "", positional = true}]
269-
cmd = "jupyter lab ${paths}"
270-
executor = {group = ["jupyter", "notebooks"]}
271-
help = "Launch Jupyter Lab"
272-
273-
[tool.poe.tasks.linkcheck]
223+
[tool.poe.groups.doc.tasks.linkcheck]
274224
cmd = """
275225
sphinx-build \
276226
--builder=linkcheck \
@@ -283,29 +233,60 @@ env = {PYTHONWARNINGS = ""}
283233
executor = {group = "doc"}
284234
help = "Check external links in the documentation (requires internet connection)"
285235

286-
[tool.poe.tasks.nb]
236+
[tool.poe.groups.notebook]
237+
heading = "Notebooks"
238+
239+
[tool.poe.groups.notebook.tasks.lab]
240+
args = [{name = "paths", default = "", positional = true}]
241+
cmd = "jupyter lab ${paths}"
242+
executor = {group = ["jupyter", "notebooks"]}
243+
help = "Launch Jupyter Lab"
244+
245+
[tool.poe.groups.notebook.tasks.nb]
287246
args = [{name = "paths", default = "docs", multiple = true, positional = true}]
288247
cmd = "pytest --nbmake --nbmake-timeout=0 ${paths}"
289248
executor = {group = "notebooks", with = "nbmake"}
290249
help = "Run all notebooks"
291250

292-
[tool.poe.tasks.style]
293-
cmd = "pre-commit run --all-files"
294-
executor = {extra = "scipy", group = "style"}
295-
help = "Perform all linting, formatting, and spelling checks"
251+
[tool.poe.groups.test]
252+
heading = "Testing"
253+
254+
[tool.poe.groups.test.tasks.cov]
255+
cmd = """
256+
pytest \
257+
--cov=ampform \
258+
--cov-fail-under=75 \
259+
--cov-report=html \
260+
--cov-report=xml \
261+
--numprocesses=auto \
262+
${paths}
263+
"""
264+
executor = {group = "test"}
265+
help = "Compute how much of the source code is covered by tests"
296266

297-
[tool.poe.tasks.test]
267+
[[tool.poe.groups.test.tasks.cov.args]]
268+
default = "src tests"
269+
multiple = true
270+
name = "paths"
271+
positional = true
272+
273+
[tool.poe.groups.test.tasks.docnb-force]
274+
env = {FORCE_EXECUTE_NB = "yes"}
275+
help = "Build documentation and API with notebook execution (no cache)"
276+
sequence = ["doc"]
277+
278+
[tool.poe.groups.test.tasks.test]
298279
cmd = "pytest -m 'slow or not slow' --numprocesses=auto ${paths}"
299280
executor = {group = "test"}
300281
help = "Run all unit tests"
301282

302-
[[tool.poe.tasks.test.args]]
283+
[[tool.poe.groups.test.tasks.test.args]]
303284
default = "src tests"
304285
multiple = true
305286
name = "paths"
306287
positional = true
307288

308-
[tool.poe.tasks.test-all]
289+
[tool.poe.groups.test.tasks.test-all]
309290
help = "Run all tests on each supported Python version"
310291
sequence = [
311292
{ref = "test-py310 ${paths}"},
@@ -315,32 +296,68 @@ sequence = [
315296
{ref = "test-py314 ${paths}"},
316297
]
317298

318-
[[tool.poe.tasks.test-all.args]]
299+
[[tool.poe.groups.test.tasks.test-all.args]]
319300
default = ""
320301
multiple = true
321302
name = "paths"
322303
positional = true
323304

324-
[tool.poe.tasks.test-py310]
305+
[tool.poe.groups.test.tasks.test-py310]
325306
env = {UV_PYTHON = "3.10"}
326307
ref = "test"
327308

328-
[tool.poe.tasks.test-py311]
309+
[tool.poe.groups.test.tasks.test-py311]
329310
env = {UV_PYTHON = "3.11"}
330311
ref = "test"
331312

332-
[tool.poe.tasks.test-py312]
313+
[tool.poe.groups.test.tasks.test-py312]
333314
env = {UV_PYTHON = "3.12"}
334315
ref = "test"
335316

336-
[tool.poe.tasks.test-py313]
317+
[tool.poe.groups.test.tasks.test-py313]
337318
env = {UV_PYTHON = "3.13"}
338319
ref = "test"
339320

340-
[tool.poe.tasks.test-py314]
321+
[tool.poe.groups.test.tasks.test-py314]
341322
env = {UV_PYTHON = "3.14"}
342323
ref = "test"
343324

325+
[tool.poe.tasks.all]
326+
help = "Run all continuous integration (CI) tasks locally"
327+
ignore_fail = "return_non_zero"
328+
sequence = [
329+
"benchmark",
330+
"cov",
331+
"docnb-force",
332+
"linkcheck",
333+
"style",
334+
"test-all",
335+
]
336+
337+
[tool.poe.tasks.benchmark]
338+
cmd = """
339+
pytest benchmarks \
340+
--benchmark-autosave \
341+
--benchmark-json benchmarks/output.json \
342+
--durations=0 \
343+
-k benchmark
344+
"""
345+
executor = {group = "test"}
346+
help = "Run benchmark tests and visualize performance"
347+
348+
[tool.poe.tasks.style]
349+
cmd = "pre-commit run --all-files"
350+
executor = {extra = "scipy", group = "style"}
351+
help = "Perform all linting, formatting, and spelling checks"
352+
353+
[tool.poe.tasks.upgrade]
354+
executor = {type = "simple"}
355+
help = "Upgrade lock files"
356+
parallel = [
357+
{cmd = "pre-commit autoupdate -j8"},
358+
{cmd = "uv lock --upgrade"},
359+
]
360+
344361
[tool.pytest]
345362
addopts = [
346363
"--color=yes",
@@ -573,6 +590,10 @@ rules.unresolved-attribute = "ignore"
573590
include = ["docs/amplitude/interactive.ipynb"]
574591
rules.too-many-positional-arguments = "ignore"
575592

593+
[[tool.ty.overrides]]
594+
include = ["docs/dynamics.ipynb"]
595+
rules.index-out-of-bounds = "ignore"
596+
576597
[[tool.ty.overrides]]
577598
include = ["tests/external/test_sympy.py"]
578599
rules.call-non-callable = "ignore"

src/ampform/helicity/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ class BuilderConfiguration:
607607
`~.HelicityModel.kinematic_variables` (which are expressions to compute an event-
608608
wise array of invariant masses). This is useful if final state particles are stable.
609609
"""
610-
use_helicity_couplings: bool = field(validator=instance_of(bool))
610+
use_helicity_couplings: bool = field(validator=instance_of(bool)) # ty:ignore[dataclass-field-order]
611611
"""Use helicity couplings instead of amplitude coefficients.
612612
613613
Helicity couplings are a measure for the strength of each partial two-body decay.

0 commit comments

Comments
 (0)