Skip to main content

Gnucash-CLI

CI Release PyPI Python

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.

Metadata

Release files for gnucash-cli 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gnucash-cli 0.1.0
File Size Uploaded Provenance Actions
gnucash_cli-0.1.0.tar.gz 16.8 kB With provenance Details for gnucash_cli-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gnucash-cli 0.1.0
File Interpreter ABI Platform Actions
gnucash_cli-0.1.0-py3-none-any.whl Python 3 none any Details for gnucash_cli-0.1.0-py3-none-any.whl

Total release size: 33.7 kB

Release files / gnucash_cli-0.1.0.tar.gz

Download URL gnucash_cli-0.1.0.tar.gz
Size 16.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a20bdad9d205eaab141bf2a3803070722f27daf694674397f527bf62e5d62115
BLAKE2b-256 checksum
How to use checksums
e4ccd2bd697c80ab4bf29aaf79204e86c502e601e0c6eedc4126fb8d9351116d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 8, 2026.

Transparency log

Release files / gnucash_cli-0.1.0-py3-none-any.whl

Download URL gnucash_cli-0.1.0-py3-none-any.whl
Size 16.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3ce8ce7ee494666eaddd046da61f306dca082a5f0fbc40dc391ab3387ef2a802
BLAKE2b-256 checksum
How to use checksums
1dae57b94d15be982f0cb8466ae9e9f3c22d2075ce30e69df6b1ffabb4bf7404
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 8, 2026.

Transparency log

Security for gnucash-cli 0.1.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for gnucash_cli-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 8, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page