HEP AI-callable JSON CLI for the official GnuCash engine.
Project description
Gnucash-CLI
Gnucash-CLI is the HEP command-line runtime for operating GnuCash books through the official GnuCash engine, not by directly editing SQL tables.
The intended production path is:
AI Agent
-> JSON CLI
-> GnuCash official Python bindings
-> libgnucash engine / QOF Session
-> GnuCash PostgreSQL backend
No piecash and no SQLAlchemy are used.
Requirements
You need a Python environment where GnuCash official Python bindings are importable:
import gnucash
from gnucash import Session, SessionOpenMode
On Linux this is commonly provided by a package like python3-gnucash, or by building GnuCash with:
cmake -DWITH_PYTHON=ON ...
GnuCash's own docs warn that GnuCash is effectively single-writer; do not run this CLI while the GUI is editing the same book.
Install
From PyPI:
pipx install gnucash-cli
For development:
python -m pip install -e ".[dev]"
Usage
Use a GnuCash URI. For PostgreSQL, pass the URI that your GnuCash build accepts for its SQL backend:
hep-gnucash inspect --book-uri "$GNUCASH_BOOK_URI" --json
hep-gnucash export-ledger --book-uri "$GNUCASH_BOOK_URI" --json
hep-gnucash statements --book-uri "$GNUCASH_BOOK_URI" --json --period month
hep-gnucash analyze --book-uri "$GNUCASH_BOOK_URI" --json --benchmark-file benchmarks/retail.json
hep-gnucash forecast --book-uri "$GNUCASH_BOOK_URI" --json --assumptions-file examples/forecast_assumptions.json
Write commands use official engine object creation/edit/commit:
hep-gnucash account create --book-uri "$GNUCASH_BOOK_URI" --json \
--name "Platform Fees" --type EXPENSE --parent "Expenses"
hep-gnucash transaction create --book-uri "$GNUCASH_BOOK_URI" --json \
--date 2026-05-08 --description "Cash sale" \
--splits '[{"account":"Assets:Cash","value":100},{"account":"Income:Sales","value":-100}]'
JSON Contract
Every command emits JSON to stdout:
{
"ok": true,
"command": "inspect",
"book_uri": "postgres://...",
"result": {},
"warnings": [],
"evidence": []
}
Errors are also structured JSON and return a non-zero exit code.
Safety
For PostgreSQL books there is no file copy backup. Instead, write commands return a mutation log with created GUIDs, affected accounts, and split totals. Use PostgreSQL snapshots/PITR or run against a staging book for recovery-grade workflows.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gnucash_cli-0.1.0.tar.gz.
File metadata
- Download URL: gnucash_cli-0.1.0.tar.gz
- Upload date:
- Size: 16.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a20bdad9d205eaab141bf2a3803070722f27daf694674397f527bf62e5d62115
|
|
| MD5 |
26aa67a313ac0bbe4e83c606dcb81aa3
|
|
| BLAKE2b-256 |
e4ccd2bd697c80ab4bf29aaf79204e86c502e601e0c6eedc4126fb8d9351116d
|
Provenance
The following attestation bundles were made for gnucash_cli-0.1.0.tar.gz:
Publisher:
release.yml on Harry-s-Economics-Program/Gnucash-CLI
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gnucash_cli-0.1.0.tar.gz -
Subject digest:
a20bdad9d205eaab141bf2a3803070722f27daf694674397f527bf62e5d62115 - Sigstore transparency entry: 1469023755
- Sigstore integration time:
-
Permalink:
Harry-s-Economics-Program/Gnucash-CLI@85f13857c06b2bc3bdd50be1d49ed05a38d123f6 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Harry-s-Economics-Program
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@85f13857c06b2bc3bdd50be1d49ed05a38d123f6 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file gnucash_cli-0.1.0-py3-none-any.whl.
File metadata
- Download URL: gnucash_cli-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ce8ce7ee494666eaddd046da61f306dca082a5f0fbc40dc391ab3387ef2a802
|
|
| MD5 |
02492c346f70c4364c301460d59a1161
|
|
| BLAKE2b-256 |
1dae57b94d15be982f0cb8466ae9e9f3c22d2075ce30e69df6b1ffabb4bf7404
|
Provenance
The following attestation bundles were made for gnucash_cli-0.1.0-py3-none-any.whl:
Publisher:
release.yml on Harry-s-Economics-Program/Gnucash-CLI
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gnucash_cli-0.1.0-py3-none-any.whl -
Subject digest:
3ce8ce7ee494666eaddd046da61f306dca082a5f0fbc40dc391ab3387ef2a802 - Sigstore transparency entry: 1469023842
- Sigstore integration time:
-
Permalink:
Harry-s-Economics-Program/Gnucash-CLI@85f13857c06b2bc3bdd50be1d49ed05a38d123f6 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Harry-s-Economics-Program
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@85f13857c06b2bc3bdd50be1d49ed05a38d123f6 -
Trigger Event:
workflow_dispatch
-
Statement type: