Getting Started with bonsai-io#
This guide walks through preparing a development environment, obtaining the required datasets, and validating your installation.
Prerequisites#
Python: 3.9 – 3.12 (project CI currently targets 3.10–3.11). Check with
python --version.Git: ensure
git --versionsucceeds.Build tooling:
pip≥ 22 and a C/C++ compiler for optional native dependencies.BONSAI account: request an API token via the bonsai.io portal. First create a user if you do not yet have one.
Configure Environment#
Set the BONSAI_HOME environment variable to the directory that will contain the _bonsai/ data bundle.
# Windows PowerShell
$env:BONSAI_HOME = "C:\\bonsai_data"
# macOS / Linux (shell profile)
export BONSAI_HOME="$HOME/bonsai_data"
BONSAI_HOMEmust be the parent directory of_bonsai/. For example, if your data resides in/data/bonsai/_bonsai/, setBONSAI_HOME=/data/bonsai.
Store long‑lived secrets (such as BONSAI_TOKEN) in your shell profile or a password manager; never commit them to the repository.
Accessing Data#
For questions about dataset availability or onboarding:
Email the BONSAI administrator: admin.gettingthedataright@aau.dk
Or open an issue on GitLab
Install bonsai-io#
Clone the repository#
git clone git@gitlab.com:bonsamurais/bonsai/build/hybrid_sut.git
cd hybrid_sut
Editable install for development#
pip install -e .[testing]
Install a specific version#
git checkout tags/<version>
pip install .
Upgrade an existing clone#
git pull origin main
pip install .
To pin bonsai-io as a dependency of another project, reference the Git repository directly:
# pyproject.toml
bonsai-io = { git = "ssh://git@gitlab.com/bonsamurais/bonsai/build/hybrid_sut.git" }
Verify the Setup#
Run a smoke test:
pytest -k versions -qBuild the documentation to confirm Sphinx/requirements:
make -C docs htmlOpen
docs/_build/html/index.htmlto view the generated site locally
CI expects pytest, flake8, and tox -e docs to pass before a merge request is accepted.
Working with the Docs#
Documentation is written in Markdown (MyST) and rendered with
pydata_sphinx_themeEach page exposes an “Edit on GitLab” button; use it to raise quick documentation merge requests
A floating “How can we improve this page?” widget links directly to pre-filled GitLab issue forms
Remember to record doc-facing changes in
docs/CHANGELOG.md
Helpful Commands#
Task |
Command |
|---|---|
Run all tests |
|
Lint source + tests |
|
Build docs |
|
Clean build artefacts |
|
Next Steps#
Read
docs/methodology.mdfor an overview of the supply–use methodologyExplore workflow entry points in
workflow_manager.pyConsult
tests/for examples of prepared fixtures and task-level tests