|
| 1 | +# Using this template |
| 2 | + |
| 3 | +This repository is a **GitHub template** for new PathSim toolboxes. It gives |
| 4 | +every toolbox the same layout, CI, packaging and docs contract, so they don't |
| 5 | +drift apart. |
| 6 | + |
| 7 | +> This file is for the person setting up a new toolbox. The `init.py` script |
| 8 | +> deletes it once initialization is done. |
| 9 | +
|
| 10 | +## 1. Create the repo |
| 11 | + |
| 12 | +On GitHub, click **Use this template → Create a new repository**. Name it |
| 13 | +`pathsim-<name>` and put it in the `pathsim` organization. |
| 14 | + |
| 15 | +## 2. Run the initializer |
| 16 | + |
| 17 | +Clone the new repo and run: |
| 18 | + |
| 19 | +```bash |
| 20 | +python init.py <name> --description "<one-line description>" --label <Label> |
| 21 | +``` |
| 22 | + |
| 23 | +- `<name>` — short, lowercase, e.g. `rf`, `chem`, `vehicle`. Becomes the |
| 24 | + package `pathsim_<name>`, the distribution `pathsim-<name>`, and the docs |
| 25 | + slug `docs.pathsim.org/<name>`. |
| 26 | +- `--description` — one-line project description for `pyproject.toml` / README. |
| 27 | +- `--label` — display capitalization for `PathSim-<Label>` (defaults to the |
| 28 | + capitalized name; pass `RF` explicitly for acronyms). |
| 29 | + |
| 30 | +The script renames `src/pathsim_toolbox/`, rewrites every reference across the |
| 31 | +repo, removes the template banner from `README.md`, and finally deletes |
| 32 | +`TEMPLATE.md` and `init.py`. Commit the result. |
| 33 | + |
| 34 | +## 3. Replace the placeholder content |
| 35 | + |
| 36 | +- `src/pathsim_<name>/example_block.py` — replace `FirstOrderLag` with your |
| 37 | + real blocks. Keep the structure: header comment, docstring documenting |
| 38 | + math / parameters / ports, input validation, `*_port_labels`. |
| 39 | +- `tests/` — mirror the structure of `src/`. Tests run with both `unittest` |
| 40 | + and `pytest`; physics is verified through a full `Simulation`. |
| 41 | +- `docs/source/examples/` — example notebooks. The placeholder is a copied |
| 42 | + PathSim core example; replace it with notebooks that demonstrate your |
| 43 | + blocks. Every `*.ipynb` here is executed and rendered by the docs build. |
| 44 | + |
| 45 | +## 4. Register with the docs build |
| 46 | + |
| 47 | +The documentation site (`docs.pathsim.org`) is built by the |
| 48 | +[`pathsim/docs`](https://github.com/pathsim/docs) repository. It clones every |
| 49 | +toolbox listed in `scripts/lib/config.py` and builds API docs + notebooks per |
| 50 | +git tag. |
| 51 | + |
| 52 | +To make the new toolbox appear, open a PR on `pathsim/docs` adding an entry to |
| 53 | +`PACKAGES` and `MIN_SUPPORTED_VERSIONS` in `scripts/lib/config.py`: |
| 54 | + |
| 55 | +```python |
| 56 | +"<name>": { |
| 57 | + "repo": ROOT_DIR / "pathsim-<name>", |
| 58 | + "source": ROOT_DIR / "pathsim-<name>" / "src", |
| 59 | + "notebooks": ROOT_DIR / "pathsim-<name>" / "docs" / "source" / "examples", |
| 60 | + "figures": ROOT_DIR / "pathsim-<name>" / "docs" / "source" / "examples" / "figures", |
| 61 | + "display_name": "PathSim-<Label>", |
| 62 | + "griffe_package": "pathsim_<name>", |
| 63 | + "github_repo": "pathsim/pathsim-<name>", |
| 64 | + "root_modules": ["pathsim_<name>"], |
| 65 | + "required": False, |
| 66 | +}, |
| 67 | +``` |
| 68 | + |
| 69 | +The repo-side docs contract is just: an importable package under `src/` and |
| 70 | +`*.ipynb` files under `docs/source/examples/`. No Sphinx — the docs build owns |
| 71 | +all rendering. |
| 72 | + |
| 73 | +## 5. Releasing |
| 74 | + |
| 75 | +`.github/workflows/publish.yml` publishes to PyPI via trusted publishing when |
| 76 | +a GitHub Release is published. Versions come from git tags via `setuptools-scm`, |
| 77 | +so tag releases as `vX.Y.Z`. Configure a |
| 78 | +[PyPI trusted publisher](https://docs.pypi.org/trusted-publishers/) for the |
| 79 | +project pointing at this repo and the `publish.yml` workflow. |
0 commit comments