Skip to content

Export CurlCurl/ToyDrift in struphy.api.models; fix model docstring and propagator Options template - #798

Merged
spossann merged 3 commits into
develfrom
fix-793-794-795
Oct 19, 2026
Merged

spossann merged 3 commits into
develfrom
fix-793-794-795

Conversation

@spossann

Copy link
Copy Markdown
Member

Closes #793, closes #794, closes #795.

  • src/struphy/api/models/__init__.py is missing CurlCurl and ToyDrift. #793: struphy.api.models now also exports CurlCurl, ToyDrift and IncompressibleNavierStokesSPH (the last one was missing too). A new test in api/tests/test_public_api.py parses api/models/__init__.py (without importing every model). It checks that __all__ matches struphy.models.__all__ and _LAZY_IMPORTS, and that each name is imported from its defining module. So a model that is missing from the hand-maintained api file now fails CI.
  • The docstring at models/base.py:84-85 still says models live in fluid.py, kinetic.py and so on, but each model now has its own file #794: the StruphyModel docstring no longer points to fluid.py/kinetic.py/... It now says one module per model, regenerate struphy/models/__init__.py with struphy build-init-files, and add the model by hand to struphy/api/models/__init__.py.
  • The template Options in propagators/base.py has opt1: str = ("implicit",), which is a tuple. #795: the template Propagator.Options now declares opt1: OptsTemplate = "implicit", the same pattern as the real propagators (e.g. implicit_diffusion.py). It used to be opt1: str = ("implicit",). check_option accepts tuples on purpose (list-valued options), which is why the old default never failed.
  • CI: src/struphy/api/tests/ was in no test shard, so its tests never ran in CI. It is now in shard-2 of reusable-unit-testing.yml and reusable-scheduled.yml and in struphy test unit. Its tests are marked mpi_skip, and the folder gets an __init__.py like the other test folders.

Follow-up for #797: once this is merged, the line "Don't copy the template in base.py literally: its opt1 default is a tuple." in src/struphy/propagators/AGENTS.md can be removed.

🤖 Generated with Claude Code

spossann and others added 3 commits October 19, 2026 15:39
….api.models; fix model and propagator templates

- api/models/__init__.py: add the three missing models; new test checks
  that its __all__ matches struphy.models (closes #793)
- models/base.py: docstring now says one model per module and where to
  register it, instead of fluid.py/kinetic.py/... (closes #794)
- propagators/base.py: template option is opt1: OptsTemplate = "implicit"
  instead of a tuple annotated as str (closes #795)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review follow-ups: api/tests/ was in no CI shard; added to shard-2 of
both workflows and to struphy test unit. The test now also checks that
each exported model is imported from its defining module.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@spossann
spossann merged commit f2f8416 into devel Oct 19, 2026
28 checks passed
@spossann
spossann deleted the fix-793-794-795 branch October 19, 2026 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant