Yet another formatter for beancount
Project description
autobean-format
Yet another formatter for beancount.
Features
- Deep cleanup.
- Normalizes all spacing.
- Full beancount v2 syntax support (except out-of-line tag / meta in
transaction
).
- Currency / cost aligning.
- Works for
open
,balance
,price
and posting.
- Works for
- Entry sorting.
- Honors
pushtag
/pushmeta
. - Honors
time
meta (HH:MM
/HH:MM:SS
/ epoch seconds / epoch ms / epoch us). - Preserves comments.
- Preserves existing structure and ordering whenever possible.
- Honors
- Thousands separator normalization.
- Adds / removes / keeps thousands separators.
- Recursive formatting.
- Recursively formats included files.
- Honors glob includes.
- Flexible output.
- Prints results / prints diff / writes back to file.
- Typed and extensible.
- For example, the code for thousands separators is as simple as this.
Usage
pip install autobean-format
# format and print results
autobean-format foo.bean
# format and write back to file
autobean-format foo.bean --output-mode=inplace
# format and print the diff
autobean-format foo.bean --output-mode=diff
# sort entries by date and time
autobean-format foo.bean --sort
# recursively format all included files
autobean-format foo.bean --recursive
# add thousands separators to all numbers
autobean-format foo.bean --thousands-separator=add
# see more options
autobean-format -h
Examples
autobean-format foo.bean \
--indent=' ' \
--currency-column=30 \
--cost-column=35 \
--thousands-separator=add \
--spaces-in-braces \
--sort \
--recursive \
--output-mode=inplace
Before | After |
---|---|
2000-01-01 open Assets:Foo USD,XXX
2000-01-01 * "foo" ^aa #bb
meta:123
Assets:Foo -1.23*4000USD ;X
Assets:Foo 1000 XXX {4.92 USD}
meta:456
include "price.*"
2000-01-02 balance Assets:Foo -4920USD
2000-01-02 balance Assets:Foo 1000XXX
2021-01-01 price EUR 1.21 USD
;leading comment
2021-01-04 price GBP 1.36 USD ; Y
2021-01-01 price JPY 0.009 USD
2020-01-01 price EUR 1.12 USD
2020-01-02 price GBP 1.32USD
2020-01-01 price JPY 0.009 USD
|
2000-01-01 open Assets:Foo USD, XXX
2000-01-01 * "foo" ^aa #bb
meta: 123
Assets:Foo -1.23 * 4,000 USD ; X
Assets:Foo 1,000 XXX { 4.92 USD }
meta: 456
include "price.*"
2000-01-02 balance Assets:Foo -4,920 USD
2000-01-02 balance Assets:Foo 1,000 XXX
2020-01-01 price EUR 1.12 USD
2020-01-01 price JPY 0.009 USD
2020-01-02 price GBP 1.32 USD
2021-01-01 price EUR 1.21 USD
2021-01-01 price JPY 0.009 USD
; leading comment
2021-01-04 price GBP 1.36 USD ; Y
|
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
autobean-format-0.1.4.tar.gz
(12.8 kB
view details)
Built Distribution
File details
Details for the file autobean-format-0.1.4.tar.gz
.
File metadata
- Download URL: autobean-format-0.1.4.tar.gz
- Upload date:
- Size: 12.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.7.0 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | af8f9ba7e3a16a2197558275185ace022800ed65513f2905e9cb91e2982b117b |
|
MD5 | 3ed2031df3056293582d10f8275a81f0 |
|
BLAKE2b-256 | 8d7a97a80def9038d743d74d3ab3f91a9beb429de2d4784927b3b862b8a4a678 |
File details
Details for the file autobean_format-0.1.4-py3-none-any.whl
.
File metadata
- Download URL: autobean_format-0.1.4-py3-none-any.whl
- Upload date:
- Size: 18.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.7.0 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa5894f5fad0cf82b073106c8e64b7ff1864fd211ccba748e2884cc68c9b2451 |
|
MD5 | 045755614ed19fd700637269faf8e16c |
|
BLAKE2b-256 | 0e28cdd88b003ef9f19e001909529311c2549e7010f3b8365c6532eaca55776f |