TopHat icon indicating copy to clipboard operation
TopHat copied to clipboard

FR: import beancount format

Open andrey-jef opened this issue 3 years ago • 6 comments

This is a feature request.

Situation:

Hi, I just've hopped in here from your post in Hacker News. FYI, I'm using plain text accounting with beancount for transactions journal, and fava as its web GUI.

Feature request:

If you have interest, a feature to import from beancount file format would be curious to explore.

Thanks

andrey-jef avatar Feb 28 '22 00:02 andrey-jef

Very curious to see if this goes anywhere. I've been toying with creating an app very similar to this but backed by a ledger file. This could possibly save me a bunch of work 🙂

tgrosinger avatar Mar 01 '22 02:03 tgrosinger

Hey both - love that you're interested. I've had a look, and beancount definitely looks like a reasonable fit for what I'm going for here: most of the language maps pretty directly to existing primitives in TopHat.

That said, I can't immediately see an authoritative JS library for the file format, and I feel like doing that here is probably scope creep beyond what this project should be. If there's something out there though, I could maybe look at using it as an import/export target?

Failing that, it looks like Python has solid interfaces to beancount and could probably convert pretty easily between the TopHat json imports/exports (no documentation right now, but downloading the test data as json should be pretty self-explanatory) and the beancount format. You could probably convert them over pretty easily that way, if you're happy with the programming side?

Athenodoros avatar Mar 01 '22 09:03 Athenodoros

Hi @Athenodoros - https://github.com/tgrosinger/ledger-obsidian has a typescript parser of the ledger format (similar to beancount's). In case it's useful.

simonmichael avatar Mar 01 '22 15:03 simonmichael

True. I could also break that out into a separate repo. I'm planning on continuing to add more of the ledger spec over time.

tgrosinger avatar Mar 01 '22 17:03 tgrosinger

Oh! @tgrosinger knows. :)

simonmichael avatar Mar 01 '22 17:03 simonmichael

I think I'd be open to it in a standalone package, although I'd definitely want to see it before committing either way - like I say, I don't want to blow this out too much in a different direction...

Let me know if you end up doing it - I think on the TopHat side the integration would be pretty straight-forward.

Athenodoros avatar Mar 02 '22 23:03 Athenodoros