git-notes-db
This tool helps store structured information in git-notes. It aims to be usable manually, but also for creating other scripts.
Usage
When setting value specify a name as the first argument (this will be
refs/notes/<name>). In this example we use test_results.
The second argument is the commit this data is about.
The third argument is what to store, this can be anything that jq accepts, including standard JSON.
All operations must be run from within a git repository.
$ git-notes-db set test_results HEAD '{passed: false, older_results: []}'
To read the data back;
$ git-notes-db get test_results HEAD
> {"passed": false, "older_results": []}
When updating, the jq expression gets any original value as an input (or null if no original value is stored). This allows for selective updating, or merging data.
$ git-notes-db set test_results HEAD '{passed: true, older_results: .older_results + [.passed]}'
$ git-notes-db get test_results HEAD
> {"passed": true, "older_results": [false]}
Other commands
get_all
It's also possible to get all known results with get_all. This also accepts
jq expressions which modify the output results.
match
Return's results matching supplied jq expression.
Todo
- Allow limiting queries/get by git revision range.
- Add subcommand to run some executable and store result. See git-branchless for inspiration. - Could make nice tui with textual.
- Package and push to pypi.
- Nix flake.
- Add helper to
pushgiven notes to a remote. - Add helper to automatically configure git to fetch notes from remote.
- Add note merge helper. Use jq expression to handle merge.
- Add ability to specify a key (e.g. message).
When this key is present on a result that's being set, also update a
secondary human readable note for including in git log output with
notes.displayRef. - Add toggle for
matchthat outputs just commits newline separated. - Add option for
matchandget_allthat stops searching afternresults are outputted. - Add option for
matchthat fails if number of results is outside a given range. - githooks / ci.
- More tutorial with usage examples.
- Feel like I've reinvented the wheel with the way I've built up the cli commands. I've not seen the state of CLI helper libraries recently. Maybe try Typer. or felix-martel/pydanclick: Add click options from a Pydantic model
Development Notes
- Haven't decided whether I want to primarily use github or gitlab.
- A bit over-engineered. Trying out some stuff.
- Trying out jujutsu VCS, commits might be weird until I work it out.
- Had originally planned to use more asyncio. Right now a bunch of stuff is async that probably doesn't need to be. Will leave this behind incase I end up wanting to parallelise things in future.
- Ruff should be used to format code.
- Basedpyright and ruff should both be run for static testing.
- Write unit/integration tests suitable for pytest.
Metadata
Release files for git-notes-db 0.1.31
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| git_notes_db-0.1.31.tar.gz | 14.3 kB | Without provenance | Details for git_notes_db-0.1.31.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| git_notes_db-0.1.31-py3-none-any.whl | Python 3 | none | any | Details for git_notes_db-0.1.31-py3-none-any.whl |
Total release size: 28.7 kB
Release files / git_notes_db-0.1.31.tar.gz
| Download URL | git_notes_db-0.1.31.tar.gz |
|---|---|
| Size | 14.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
17f46a769b57cdd9537fecd6c9f774548feb40ca4a724c9ec5d3a5f06b64ffc1
|
|
BLAKE2b-256 checksum How to use checksums |
a308b33791a0252e6c40b6de0d4d239cf4270256aa637b76ed92a49639259613
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Release files / git_notes_db-0.1.31-py3-none-any.whl
| Download URL | git_notes_db-0.1.31-py3-none-any.whl |
|---|---|
| Size | 14.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
345f25da37471b1e637f076f22a633ff88906ee5f1dca4be3b28feaa30897041
|
|
BLAKE2b-256 checksum How to use checksums |
ddf69c01c64264600c8fd9cd20403419e0c0f3c48d7e617b113abbce74b38b9b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Security for git-notes-db 0.1.31
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.