@Red I'm advertising it as "lossless" editing with strong guarantee that:
- With no editing, parsing + printing will output the exactly same contents. - When updating something (e.g. account in a posting), no character outside that object may be modified. - When inserting / removing something (e.g. new transaction), no character outside that object or its surrounding spacing may be modified. - When moving something (e.g. reordering transaction), no character except the surrounding spacing may be modified. I'll also include that in the doc I'm writing. > What do I do after cloning your repo to run a hello world example? The replit example should work out of the box. If you are cloning the repo you'll need: - The example main.py from replit (it's not in the repl) - Python 3.10+ (I used some new typing features) - Lark (pip install lark) - PYTHONPATH covering the repo @Stefano > split the project Certainly a good idea considering this has fairly different dependencies and Python version requirements. One thing stopped me from doing so is that github.com/autobean has been claimed by someone else. I'll rethink about this after finalizing the development > API reference doc Hopefully the replit example helps a bit. The full reference should come in a few weeks. > CLI interface I think this library is more powerful than what the command line expressive power allows, which is why it's now a library. Having a CLI interface for simple / common case is certainly a good idea and we can always creating them at a higher level as you said. I'm happy with some of such CLI commands to be included in this project but I don't have a concrete plan right now. Contribution is always welcomed. > Use case coverage check I can confirm *all* the use cases you listed are supported. Note that this is a relatively low level AST manipulation library and thus: - There is no dedicated interface for column alignment but you can do that by setting the number of spaces based on token positions. - There is no dedicated interface for clash detection or order enforcement, but you'll get a lot more information than beancount.loader (+spacing, +comments, +directives, +ordering, ...) so they are all doable by using this library. On Thursday, October 6, 2022 at 11:49:46 AM UTC+1 Stefano Zacchiroli wrote: > On Wed, Oct 05, 2022 at 02:39:31PM -0700, Archimedes Smith wrote: > > Anyone interested in this project? Any bug reports / suggestions would > be > > appreciated. > > This is an amazing project. I wanted to have something similar for a > very long time. Now, in terms of suggestions/questions: > > - I had already bookmarked in the past your repo (due to other cool > stuff you've in there). In spite of that I'd have never found this > project in there without this announcement email of yours. Would you > consider splitting autobean.refactor out into its own project? It'd > help a lot with visibility. > > - I could really use some API reference documentation for the library, > as the tests are hard to navigate to understand how the manipulation > logics works. > > - My initial UX idea for something like this was more like a user > language connected to some CLI driver (in the style of sed/awk/perl, > but with a DSL for Beancount). Is that something you've considered? Of > course, if it will ever come to be, it will be "just" an additional > layer on top of the manipulation library that you've now. > > Ere are some of my frequent use cases for these manipulations, in case > it helps you double-checking if they are already supported or not: > > - Rename accounts in batch, without messing up indentation. Bonus point: > detect that the rename is not creating clashes (unless explicitly > requested). > > - Change the alignment column of amounts (purely syntactical change). > > - Move metadata "up", from postings to the main transactions or > vice-versa (move them "down"). > > - Select transactions by some predicate (e.g., they have a given > narration or metadata) and perform in batch modifications to selected > ones (e.g., add/remove a metadata, set the narration to something, > etc.) > > - Ensure consistent ordering in metadata postings (e.g., "bank-label" is > always first, followed by "author", then "card", etc.). > > Hope this helps, > Cheers > -- > Stefano Zacchiroli . [email protected] . upsilon.cc/zack _. ^ ._ > Full professor of Computer Science o o o \/|V|\/ > Télécom Paris, Polytechnic Institute of Paris o o o </> <\> > Co-founder & CTO Software Heritage o o o o /\|^|/\ > Former Debian Project Leader & OSI Board Director '" V "' > -- 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/9806d439-708c-41a0-ba96-8f3e3a2984b6n%40googlegroups.com.
