Contributing¶
Thank you for helping. mindmap-synaptome (imported as synaptome) is small and opinionated: read DESIGN.md (the model and API), PLAN.md (the
build order) and ARCHITECTURE.md (where things live) before a larger change, and open an issue first to discuss
it.
Setup¶
git clone https://github.com/NinoHerve/mindmap-synaptome
cd mindmap-synaptome
uv sync --extra dev # add --extra docs to build the site
Commands¶
uv run pytest # unit tests (warnings are errors)
uv run pytest --nbmake tutorials # run every tutorial
uv run pytest --mpl tests/unit/test_plot_*.py # compare figures with the baselines
uvx ruff format . && uvx ruff check . # format + lint
uv run mkdocs serve # the documentation site, live
All four checks (lint, tests, tutorials, mkdocs build --strict) run in CI on Python 3.10–3.13.
Code¶
- Layers import downward only:
engine←study/io←questions←estimates/hypotheses←results←plot. The few upward references (study.compare,study.plot,result.plot()) import inside the method. - NumPy-style docstrings with
Parameters/Returnsfor every public name, type hints,from __future__ import annotations, lines up to 110 characters. - Errors name the problem and the fix:
"Variable 'weight' has dimensions ['time'], not ['visit'].". - No caches and no stored results: results are values.
- Public names are exported from their package's
__init__.pywith__all__. - New runtime dependencies only after discussion; optional extras are fine to propose.
Tests¶
- One file per module:
tests/unit/test_<package>_<module>.py. - For each feature: behaviour on a small hand-checkable example; reference values (SciPy, a published example,
an exact computation); each guard rail with
pytest.raises(..., match=...); edge cases (NaN, empty, one unit, ties); round trips for anything saved. - Use
synaptome.datasetstoy studies, and check that planted effects are found and null effects are not. - Randomness is always seeded; the suite stays under a minute.
- Figures:
Plot.datacarries the numbers drawn; regenerate image baselines withuv run pytest --mpl-generate-path=tests/unit/baseline -k imageand look at them.
Tutorials¶
Notebooks in tutorials/, named NN_topic.ipynb, listed in tutorials/README.md, committed without outputs.
Each opens with what the reader will learn and needs to know, has short cells each introduced by a sentence or
two on why, closes with a pointer to the next tutorial, and runs in under 30 seconds. When an API used by a
tutorial changes, update the tutorial in the same change.
Documentation¶
Pages live in docs/ (concepts) and are built with MkDocs Material; the API reference comes from the docstrings
and the tutorials are executed at build. Record non-obvious decisions in DESIGN.md §14 with the date, and keep
ARCHITECTURE.md current.
Pull requests¶
Keep a pull request to one topic, with tests, tutorial and docs updates, a green CI and an entry under
[Unreleased] in CHANGELOG.md.
Releasing¶
The version lives in one place, __version__ in src/synaptome/__init__.py (the package build reads it from
there). To release:
- Set
__version__to the new version (for example0.1.0) and turn[Unreleased]inCHANGELOG.mdinto that version with the date; commit onmain. - Tag and push:
git tag v0.1.0 && git push origin v0.1.0.
The publish workflow builds the package, refuses a tag that doesn't match __version__, tests the built
wheel, uploads to TestPyPI, then to PyPI. Running it by hand from the Actions tab stops after TestPyPI (a dry
run). Afterwards set __version__ to the next development version (for example 0.2.0.dev0).