Different behavior when using "include"

108 views
Skip to first unread message

Matt Hellige

unread,
May 3, 2021, 3:12:16 PM5/3/21
to Beancount
Hi all...

I'm exploring beancount, hoping to migrate a few different projects from ledger, some personal books as well as the bookkeeping system that I handle for a non-profit. There are a bunch of things I find very attractive about beancount, but there are a few sticking points and trade-offs, especially in the non-profit scenario. So, most likely I'll have other questions while I try to figure out whether I can make this transition successfully.

But right away I ran into something very strange. I use the include directive heavily, organizing things into sub-directories by year, transaction type, etc. But right away, I see several behavioral differences when I  move transactions into include files. The number of decimal places changes, as well as the output alignment of bean-report.

In bar.beancount:

    2021-01-01 open Assets:Cash
    2021-01-01 open Expenses:Blah

    2021-01-01 * "Test"
      Assets:Cash         -100.00 USD
      Expenses:Blah

And in foo.beancount:

    include "bar.beancount"

Then:

    $ bean-report bar.beancount bal
    Assets:Cash     -100.00 USD
    Equity
    Expenses:Blah    100.00 USD
    Income
    Liabilities

But:

    $ bean-report foo.beancount bal
    Assets:Cash   -100.00000000 USD
    Equity
    Expenses:Blah 100.00000000 USD
    Income
    Liabilities

This seems totally bizarre... Googling, I found a few discussions of this type of issue, but no firm conclusions about whether or not it's a bug. I found that I can fix the decimal inference by adding a bogus transaction to the root file (but this is not really a long-term solution for a collection of books, where the root file is mostly just global options and accounts can be opened/closed as needed, by date, in individual years). And even so, I still can't fix the alignment issue.

More generally, this is concerning to me, because it seems to completely violate the stream-processing date-ordered philosophy of beancount, which is one of the things that really appealed to me in the first place. In fact, the beancount docs themselves explictly say: "All directives are parsed and then basically stably sorted before any calculation or validation occurs. This also makes it trivial to implement inclusions of multiple files (you can just concatenate the files if you want)." But this is certainly not true!

So, is this the expected behavior, or is this a bug? Is there any way to add explicit options to the top-level file to guarantee that the file-location of transactions really makes absolutely no difference?

Thanks for the great tool, I really appreciate all the thought and hard work that has gone into beancount, the related tools and all the documentation!

Matt





Matt Hellige

unread,
May 20, 2021, 7:26:40 PM5/20/21
to bean...@googlegroups.com
I presume, from the crickets on this one, that I should probably just create a github issue for it...

--
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 on the web visit https://groups.google.com/d/msgid/beancount/4f2ed688-229f-4779-a90f-a601e6b0f3a9n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages