I'm a happy +GnuCash user, although I use only a bare minimum of its features. Still, it makes me somewhat happy that I can easily expand if I ever need to. Yesterday, I realized that for a specific purpose I now have, the built-in reporting tools are simply not sufficient.

No worries, GNU Cash is extensible, right?

First attempt: A Scheme script. I know Scheme quite well, even though I'm a bit rusty. Sadly, I ran against various walls pretty quickly. The API documentation is ... limited. And worse, the API design is also ... er, "rudimentary." There is no consistency, nothing. I guess it's survivable if you know the C code base. I don't. Still, with a lot of copy&paste of code I didn't understand, trial and error, and cursing, I managed to get a report the way I wanted it. Or well, as close to what I wanted. 139 lines. And it fails from time to time. The debugging options are horrible (a window with error messages and ideally a REPL would be awesome, you know). And I have no clue how to extend it sensibly.

But hey, there are Python bindings. Maybe those are better. A lot of cursing later, I came to the conclusion that no, they aren't. Same problems, really. I put some effort into trying to make sense of the API, but it was a huge PITA, and half of it didn't even work. But at least it was loadable in a usable REPL.

I ended up writing my own parser of GNU Cash XML files in Python. The whole parser including all classes I use takes up 295 lines. Mind, that's just accounts, transactions, and splits, but that's plenty enough for most reports.

The Python script to generate the report I wanted takes up 25 lines. And I feel a lot more in control of the whole thing.

I understand that not every program can be as extensible as #emacs  - and I also understand that actually, most programs are not extensible at all. But really. I would have hoped for a bit more here. :-(
Shared publiclyView activity