Skip to main content

beancount-parser CircleCI

Standalone Lark LALR(1) based Beancount syntax parser (not relying on Beancount library), MIT license

Please also checkout out beancount-black, an opinionated beancount code formatter based on beancount-parser.

Features

  • MIT licensed - the only dependency is Lark
  • Extremely fast - LALR(1) is used
  • Section awareness - emac org symbol mark * will be parsed
  • Comment awareness - comments will be parsed
  • Not a validator - it does not validate beancount syntax, invalid beancount syntax may still pass the parsing

Sponsor

The original project beancount-parser was meant to be an internal tool built by Launch Platform LLC for

BeanHub logo

A modern accounting book service based on the most popular open source version control system Git and text-based double entry accounting book software Beancount. We realized adding new entries with BeanHub automatically over time makes the beancount file a mess. So, a strong code formatter is needed. While SaaS businesses won't be required to open-source an internal tool like this, we still love that the service is only possible because of the open-source tool we are using. It would be greatly beneficial for the community to access a tool like this, so we've decided to open-source it under an MIT license. We hope you find this tool useful 😄

Install

To install the parser, simply run

pip install beancount-parser

Usage

If you want to run the parse beancount code, you can do this

import io

from beancount_parser.parser import make_parser

parser = make_parser()
tree = parser.parse(beancount_content)
# do whatever you want with the tree here

Feedbacks

Feedbacks, bugs reporting or feature requests are welcome 🙌, just please open an issue. No guarantee we have time to deal with them, but will see what we can do.

Metadata

Release files for beancount-parser 1.2.3

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

Source distribution (sdist)

Source distribution for beancount-parser 1.2.3
File Size Uploaded
beancount_parser-1.2.3.tar.gz 8.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for beancount-parser 1.2.3
File Interpreter ABI Platform
beancount_parser-1.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 19.4 kB

Release files / beancount_parser-1.2.3.tar.gz

Download URL beancount_parser-1.2.3.tar.gz
Size 8.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c24208d4561e5bd5ed4e544b1cd77afcf7b309211f32f7927585ef525c13578d
BLAKE2b-256 checksum
How to use checksums
a436a9bc86adb1319fba231dd9dcfca75c31f9e7dd7495260978d102ce506548
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.10.11 Linux/5.15.0-1056-aws

Release files / beancount_parser-1.2.3-py3-none-any.whl

Download URL beancount_parser-1.2.3-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8d8415a06dbd9fe07170071fdb45e7063c6e81239ee48bda46292ce9d1bd68dc
BLAKE2b-256 checksum
How to use checksums
77fff0efb163d3a9614fe9d7c477556cd788599d45ba6629e6df91764ad05f91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.10.11 Linux/5.15.0-1056-aws

Release history Release notifications | RSS feed

This release

1.2.3 This release

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.2.0

2 release files

0.1.24

2 release files

0.1.20

2 release files

0.1.19

2 release files

0.1.18

2 release files

0.1.17

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

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