Very cool project! I've run into many/most of the use cases you mentioned. Question: would there be a set of editing guarantees that autobean.refactor provides? Examples could be: - every input line that is not modified by a plugin will appear exactly once in the output - no modifications within a line will occur (other than those made by plugins) - etc.
Also: what do I do after cloning your repo to run a hello world example? Thanks again for sharing, and look forward to seeing this project grow and mature! On Wednesday, October 5, 2022 at 2:39:31 PM UTC-7 [email protected] wrote: > Hi beancounters, > > One thing I have been wanting for long in beancount ecosystem is some > tooling to programmatically *edit* my ledger. For example: > > - Formatting > - Sort ledger entries, without losing formatting, comments, or > pushtag. > - Sort postings / meta. > - Format non-transactions and details (e.g. inside cost) that > bean-format doesn't do. > - Enforce formatting rules. > - Refactoring > - Rearrange my accounts based on narration / tags / comments. > - Optimize existing ledgers with plugins. > - Migrate some posting meta to the inline form by > autobean.narration > <https://github.com/SEIAROTg/autobean/tree/master/autobean/narration> > . > - Migrate my tedious stock split transactions to use the > single-line form by autobean.stock_split > > <https://github.com/SEIAROTg/autobean/tree/master/autobean/stock_split> > . > - Ease plugin usage by having automatic onboarding script that > inserts "plugin" directive and optimize existing ledger. > - Automatically migrate from v2 to v3 syntax. > - Automatically migrate from / to other bookkeeping systems. > - Importing > - Generate postings with total price (@@), which the official > models don't support. > - Let importers insert transactions directly to the right file, at > the right line. > - Let importers find and augment existing transactions. > - A receipt OCR importer may find the transaction previously > imported from the bank and add postings about what I bought. > - Automatically generate refund transaction in an editor extension. > > There are some existing ways doing editing: > > - Manual editing always works, but takes time. > - Plugin is great but sometimes I want to land the changes in the file. > - beancount.loader applies plugins, drops spacing, comments and > directives (pushtag). > - beancount.parser doesn't apply plugins, but also drops spacing, > comments and directives. > > As a solution to *all* above use cases, I've come up with > autobean.refactor > <https://github.com/SEIAROTg/autobean/tree/master/autobean/refactor>, > which is a pure Python library providing an ergonomic yet powerful > interface to edit beancount files. It's now 80% completed so I'm sharing it > here, though there are still some missing pieces (coming soon): > > - Documentation > - Performance improvements > - Support for out-of-line tags / links in transaction > > You can play with it here: > https://replit.com/@SEIAROTg/autobeanrefactor-example#main.py or check > out more examples in tests > <https://github.com/SEIAROTg/autobean/tree/master/autobean/refactor/tests> > . > > Anyone interested in this project? Any bug reports / suggestions would be > appreciated. > > Regards, > SEIAROTg > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/5ff865b5-bfc3-4a4b-b4b7-973f50282969n%40googlegroups.com.
