This repository is a GitHub template for new PathSim toolboxes. It gives every toolbox the same layout, CI, packaging and docs contract, so they don't drift apart.
This file is for the person setting up a new toolbox. The
init.pyscript deletes it once initialization is done.
On GitHub, click Use this template → Create a new repository. Name it
pathsim-<name> and put it in the pathsim organization.
Clone the new repo and run:
python init.py <name> --description "<one-line description>" --label <Label><name>— short, lowercase, e.g.rf,chem,vehicle. Becomes the packagepathsim_<name>, the distributionpathsim-<name>, and the docs slugdocs.pathsim.org/<name>.--description— one-line project description forpyproject.toml/ README.--label— display capitalization forPathSim-<Label>(defaults to the capitalized name; passRFexplicitly for acronyms).
The script renames src/pathsim_toolbox/, rewrites every reference across the
repo, removes the template banner from README.md, and finally deletes
TEMPLATE.md and init.py. Commit the result.
src/pathsim_<name>/example_block.py— replaceFirstOrderLagwith your real blocks. Keep the structure: header comment, docstring documenting math / parameters / ports, input validation,*_port_labels.tests/— mirror the structure ofsrc/. Tests run with bothunittestandpytest; physics is verified through a fullSimulation.docs/source/examples/— example notebooks. The placeholder is a copied PathSim core example; replace it with notebooks that demonstrate your blocks. Every*.ipynbhere is executed and rendered by the docs build.
PathView ships a browser build that runs Python through Pyodide. Pure-Python
toolboxes load there out of the box, but dependencies that ship native code
(pybamm, jsbsim, casadi, anything that needs a compiled wheel) fail to
install in the browser.
Default pip install pathsim-<name> on Linux/macOS/Windows should still
install everything — no extras required. To get there:
-
Mark heavy dependencies in
pyproject.tomlwith a PEP 508 environment marker so micropip (Pyodide) silently skips them:dependencies = [ "pathsim>=0.22", "numpy>=1.15", "pybamm>=25.12; sys_platform != 'emscripten'", ]
-
Guard the re-export in
src/pathsim_<name>/__init__.pyso the rest of the toolbox stays importable when the heavy dep is missing:try: from .cells import CellElectrical __all__ += ["CellElectrical"] except ImportError: pass
In PathView's web Toolbox Manager, introspection then finds only the blocks whose submodules imported successfully; the desktop install sees everything.
The documentation site (docs.pathsim.org) is built by the
pathsim/docs repository. It clones every
toolbox listed in scripts/lib/config.py and builds API docs + notebooks per
git tag.
To make the new toolbox appear, open a PR on pathsim/docs adding an entry to
PACKAGES and MIN_SUPPORTED_VERSIONS in scripts/lib/config.py:
"<name>": {
"repo": ROOT_DIR / "pathsim-<name>",
"source": ROOT_DIR / "pathsim-<name>" / "src",
"notebooks": ROOT_DIR / "pathsim-<name>" / "docs" / "source" / "examples",
"figures": ROOT_DIR / "pathsim-<name>" / "docs" / "source" / "examples" / "figures",
"display_name": "PathSim-<Label>",
"griffe_package": "pathsim_<name>",
"github_repo": "pathsim/pathsim-<name>",
"root_modules": ["pathsim_<name>"],
"required": False,
},The repo-side docs contract is just: an importable package under src/ and
*.ipynb files under docs/source/examples/. No Sphinx — the docs build owns
all rendering.
.github/workflows/publish.yml publishes to PyPI via trusted publishing when
a GitHub Release is published. Versions come from git tags via setuptools-scm,
so tag releases as vX.Y.Z. Configure a
PyPI trusted publisher for the
project pointing at this repo and the publish.yml workflow.