Beancount Enhancement Proposal: I/O plugins

65 views
Skip to first unread message

Tim Sweña

unread,
Mar 7, 2026, 2:56:15 PM (5 days ago) Mar 7
to bean...@googlegroups.com
Hello folks,

I am just getting started with Beancount and was excited about:

> Any line that does not begin as a valid Beancount syntax directive (e.g. with a date) is silently ignored.

from the language syntax guide, but that turned out to be out-dated (https://github.com/beancount/beancount/issues/388). I got kinda attached to the idea of a "literate programming" ledger, so I thought of a proposal that I think could fit well into the current plugin architecture:

I/O plugins. These intercept and transform the raw file input/output (I/O) stream before Beancount's standard parser sees the content.

For easier commenting, I wrote the up in more detail at:

I'd love to hear your thoughts.

--Tim

Martin Blais

unread,
Mar 7, 2026, 4:55:07 PM (4 days ago) Mar 7
to bean...@googlegroups.com
This other type of plugin should operate on the AST, with round trip capability.
Beancount doesn't _really_ have a proper AST.
Text transformations such as what you propose should be done as preprocessing, not in Beancount.



--
You received this message because you are subscribed to the Google Groups "Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beancount+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/beancount/CACv%3DJ46E05uk5a1rdCZyCbrMosFUpgwRCpvEBULHnvFYrHa69Q%40mail.gmail.com.

Tim Sweña

unread,
Mar 7, 2026, 5:04:09 PM (4 days ago) Mar 7
to bean...@googlegroups.com
True. This proposal can't do a round trip. I'll ponder what it'd take to introduce a proper AST.

Martin Blais

unread,
Mar 7, 2026, 5:19:18 PM (4 days ago) Mar 7
to bean...@googlegroups.com
I won't be able to accept large PRs on Beancount at this time.
I would recommend you do a fork and use and maintain that for a while until the bugs are ironed out.
This would require recreating the parser and seeing as I'd like to rewrite all the core in another language I'm not sure it'll be productive to do that on the Python/C version it currently is.



Alan H

unread,
Mar 8, 2026, 2:32:34 PM (4 days ago) Mar 8
to Beancount
FWIW ... I make extensive use of preprocessing when entering bulk items that are not available in a manner suitable for importers. Frequently I write a set of M4 macros that let me generate beancount directives from the information in a very very compact fashion. it is a little old-school but it works. :-) My makefile builds the beancount files and it all gets source controlled just in case I want to look at things in a context where I don't have M4 (I have no idea where that would be ... )



Alan

Reply all
Reply to author
Forward
0 new messages