Development¶
PirateBox is a small FastAPI app. Development is straightforward, which is a rare kindness.
Requirements¶
- Python 3.11+.
- Virtualenv.
- Patience.
Setup¶
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt -r requirements-dev.txt
Run locally¶
uvicorn app.main:app --reload --host 0.0.0.0 --port 8080
Lint¶
ruff check .
Test¶
pytest
tests/test_boot_lifecycle.py boots a pretend Pi Zero W over and over: the real installer, first-boot
and setup scripts run inside an unprivileged user namespace against a fake systemd, kernel and radio
(tests/fake_pi.py, tests/fake-pi.sh). It needs unshare and rsync, and skips itself where user
namespaces are locked down, such as stock Ubuntu CI runners. It proves the logic, not the radio.
Semversioning¶
We use Python Semantic Release to cut semver tags based on conventional commits. It updates CHANGELOG.md and bumps VERSION. If your commit messages are chaotic, so will be the releases.
Expected flow:
- Merge conventional commits into
main. - CI runs the
Semversioningjob. - Python Semantic Release tags the release and updates the changelog.
Style notes¶
- Keep route handlers small and push persistence into
app/db.py. - Avoid external network calls; the project is offline-first.
- Favor clear, small diffs over ambitious rewrites.