Advice for python scripts with hledger

Hi,

I would like to script some graphs about my savings, investments... The idea would be to generate static graph files or to create jupyter/org-mode notebooks to dynamically recreate them. I think Python with matplotlib could be the solution. However, I do not know how to execute hledger commands and get the output of the commands in Python. Should I use the subprocess module? Do you have any skeleton of one python file to run and parse the output of hledger command?

Hi @zako, have you seen the Charts and Graphs - hledger page ? hledger-plot sounds like a good option..

Yes, i looked at that webpage and tried several options: years ago with ledger-cli I made custom gnuplot graphs, then with hledger I tried hledger-vega and Paisa.

What I want to create custom graphs which require data manipulation before creating the graphs.

Perhaps hledger-vega was the solution most suitable for this task, because it provides a kind of framework to create queries, export queries results to csv and then create graphs. But Vega specification was a bit complex for my understanding....

Did you try hledger-plot ? It's python and uses matplotlib

No I didn't. I looked at the documentation and I thought it lacks of data manipulation capabilities but I wll check it in more detail.