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

print(gsb.currencies)
# [CurrencySection(Nb=1, Na='Pound Sterling', Co='£', Ico='GBP', Fl=2)]

for account in gsb.accounts:
    print(account.Number, account.Name)
# 1  Mr. Account / HSBC [bank]
# 2  Mrs. Account / Barclays Bank [bank]
# ...

Detailed transactions (foreign keys resolved)

tx = gsb.detailed_transactions[0]
print(tx.Dt, tx.Am, tx.Ac.Name)
# 2023-01-02  -200000.00  Real Estate Loan [liabilities]

Convert to pandas DataFrame

import gsbparse.pandas as gsbpd

currencies_df  = gsbpd.to_df(gsb.currencies)
accounts_df    = gsbpd.to_df(gsb.accounts)
detailed_tx_df = gsbpd.to_df(gsb.detailed_transactions)

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"),
]

df = gsbpd.to_df(gsb.detailed_transactions, columns=columns)
print(df.head())
#          date      amount                         account        party
# 0  2023-01-02  -200000.00  Real Estate Loan [liabilities]  Loan Credit
# 1  2023-01-02   200000.00       Mr. Account / HSBC [bank]  Loan Credit

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.4.0.tar.gz (122.6 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.4.0-py3-none-any.whl (62.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for gsbparse-0.4.0.tar.gz
Algorithm Hash digest
SHA256 fda62c3d395e8993580c2d27a01d076d55e60f127aa5aef0d4a0a3ee6a848543
MD5 8f56686d2cf2560a091aa09ac62c720d
BLAKE2b-256 52b475b6160d257c95164ecc6ce7beaaad9936cd547bffa764df7e1860b52fd7

See more details on using hashes here.

Provenance

The following attestation bundles were made for gsbparse-0.4.0.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.4.0-py3-none-any.whl.

File metadata

  • Download URL: gsbparse-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 62.7 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.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 308c00a5feaedbcb54e9407620b5aae87160f3d1776ca84121f07639c9bde188
MD5 ba2301047f3419474c8698910c4681b8
BLAKE2b-256 988a03be1b088904764d2731a9988a94a62103d46fd02f6b1050e45bb0e3d1c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for gsbparse-0.4.0-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