Automate code releases with GitHub API, Zenodo, Zotero.
These unpolished scripts are used as infrastructure for Celeritas, letting us build and publish releases with thorough release notes and meticulous attribution.
The repository includes a reusable Hatch environment in pyproject.toml.
Install Hatch and create the environment with:
python3 -m pip install hatch
hatch env createThe environment includes the runtime dependencies and the notebook tooling
used by the release notebooks (jupyter, ipykernel, IPython, and tqdm).
To register it as a kernel for VS Code or another Jupyter client, run:
hatch run python -m ipykernel install --user \
--name celeritas-release-scripts \
--display-name "Python (Celeritas release scripts)"Then select Python (Celeritas release scripts) as the notebook kernel. The local modules in this repository are imported from the repository root; run notebooks with this directory as the working directory.
The release workflow also expects:
git, plus a local checkout of the target project;cmakeandninjawhen building documentation;- GitHub API access, using
GHAPI_TOKENor~/.config/ghapi-celeritas-token; - a Zenodo token in
~/.config/zenodo-token; - macOS
pbcopyfor copying generated release notes to the clipboard.
Run the syntax check with:
hatch run checkThe all-zenodo-release notebook is how I constructed all the Zenodo
releases, using major versions as
"concept" releases and using version updates for the patches.
These are some simple wrappers that use null separators if possible.
The ghapicache class caches ghapi queries in a file for faster retrieval
multiple times (especially useful for debugging) or when offline (yes I've done
some of this work on an airplane...)
There's no Zenodo REST API wrapper like there is for github or even zotero. Their API description is just slightly wrong, and there are a few bugs. This class simplifies access to Zenodo functionality.
These are the scripts I use to construct release notes from a git commit range.