Skip to main content

Parse Grisbi .gsb files into typed domain objects and pandas DataFrames

Project description

gsbparse

A Python library for parsing Grisbi .gsb accounting files into typed domain objects, with an optional pandas adapter for DataFrame output.

Documentation: gsbparse.readthedocs.io

Installation

pip install gsbparse

Or with uv:

uv add gsbparse

Requires Python 3.13+.

Quickstart

Read a file

import gsbparse

gsb = gsbparse.read_gsb("my_accounts.gsb")

Inspect typed sections

>>> gsb.currencies
[CurrencySection(Nb=1, Na='Euro', Co='€', Ico='EUR', Fl=2), CurrencySection(Nb=2, Na='US Dollar', Co='$', Ico='USD', Fl=2)]

>>> for account in gsb.accounts:
...     print(account.Number, account.Name)
1 Checking
2 Savings

Detailed transactions (foreign keys resolved)

>>> tx = gsb.detailed_transactions[0]
>>> tx.Dt
datetime.date(2024, 1, 5)
>>> tx.Am
Decimal('-42.50')
>>> tx.Ac.Name
'Checking'
>>> tx.Pa.Na
'Supermarket'

Convert to pandas DataFrame

>>> import gsbparse.pandas as gsbpd
>>> gsbpd.to_df(gsb.currencies)
   Nb         Na Co  Ico  Fl
0   1       Euro    EUR   2
1   2  US Dollar  $  USD   2

Custom column projection:

>>> from gsbparse import DetailedTransactionColumn
>>> columns = [
...     DetailedTransactionColumn(path="Dt",      output_name="date"),
...     DetailedTransactionColumn(path="Am",      output_name="amount"),
...     DetailedTransactionColumn(path="Ac.Name", output_name="account"),
...     DetailedTransactionColumn(path="Pa.Na",   output_name="party"),
...     DetailedTransactionColumn(path="Ca.Na",   output_name="category"),
... ]
>>> gsbpd.to_df(gsb.detailed_transactions, columns=columns)
         date   amount   account        party category
0  2024-01-05   -42.50  Checking  Supermarket     Food
1  2024-01-31  2500.00  Checking     Employer   Income

See the full quickstart and API reference on Read the Docs.

Development

git clone https://github.com/etnbsd/gsbparse.git
cd gsbparse
uv sync --dev
pre-commit install

Common commands (via make):

Command What it does
make test Run the test suite
make lint Run ruff check
make format Run ruff format
make type-check Run mypy in strict mode
make import-check Enforce hexagonal import boundaries
make ci Run all of the above

Contributing

  1. Fork the repo and create a short-lived branch.
  2. Follow Conventional Commits — enforced by pre-commit.
  3. Open a pull request against main.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gsbparse-0.5.4.tar.gz (124.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gsbparse-0.5.4-py3-none-any.whl (64.2 kB view details)

Uploaded Python 3

File details

Details for the file gsbparse-0.5.4.tar.gz.

File metadata

  • Download URL: gsbparse-0.5.4.tar.gz
  • Upload date:
  • Size: 124.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gsbparse-0.5.4.tar.gz
Algorithm Hash digest
SHA256 c55243506ae440a3500eabacce844d94dfcd9b750f2fba809860a2033aa6e841
MD5 bd44878f87d660a134309d958b375ac0
BLAKE2b-256 eb1a683e6447ae15a33cb81ae65742b1d551888b5dab2a9d222afccc0e01c9ec

See more details on using hashes here.

Provenance

The following attestation bundles were made for gsbparse-0.5.4.tar.gz:

Publisher: publish.yml on EBoisseauSierra/gsbparse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gsbparse-0.5.4-py3-none-any.whl.

File metadata

  • Download URL: gsbparse-0.5.4-py3-none-any.whl
  • Upload date:
  • Size: 64.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gsbparse-0.5.4-py3-none-any.whl
Algorithm Hash digest
SHA256 5e0c7ff4b6412795415b0f6f3142cdd45d86e643adaec53fb2dc04194626632c
MD5 1e664a704daf2e93237ee5684dd81450
BLAKE2b-256 873d50e82faa9c55cd2de7c0e158a3b3f91e249e2b521dee639534840a9f4395

See more details on using hashes here.

Provenance

The following attestation bundles were made for gsbparse-0.5.4-py3-none-any.whl:

Publisher: publish.yml on EBoisseauSierra/gsbparse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page