Hledger-lit: another hledger plotting thingie

Building upon hledger-sankey (which was previously discussed here), I’ve made hledge-lit, a Streamlit-based Python app that can plot various graphs based on the output of hledger balance.

Looks cool! I just tried it, with:

git clone https://github.com/adept/hledger-lit
python3 -m venv .venv
source ./.venv/bin/activate
pip install -r requirements.txt
streamlit run hledger_lit.app

but I get this error:

Usage: streamlit run [OPTIONS] [TARGET] [ARGS]...
Try 'streamlit run --help' for help.

Error: Streamlit requires raw Python (.py) files, not .app.
For more information, please see https://docs.streamlit.io

I’m on Arch Linux with Python 3.13.11

Right. That's a typo in the Readme, you need to replace .app with .py

I tripped on this too. Specifically, you need to rename that file:
mv hledger_lit.app hledger_lit.py

That's what you get when pushing in a hurry :slight_smile:

This should be fixed now (both readme and a filename)

I’ve pushed a bunch of changes, and one can now define account categories using regexps, and all hledger commands for every graph are disclosed and customizable as well

This is really cool! I love the sankey diagrams. I’d also like to look into using the --average -M flags for the first two plots, so we get monthly average values rather than a cumulative total.

This is really cool. I'd also love some way to specify the depth of accounts. If you have a very deep number of sub-accounts then it can get very visually cluttered.

The current version allows you to fully customise hledger command arguments, so (depending on the graph) it could be as easy as tweaking –depth there

Dear author,
My Expenses Treemap isn't showing up, but Historical Account Balances, Income & Expenses Flows, and All Cash Flows are working fine. Could you please help me figure out what's going wrong?

You can open this as a github issue at Issues · adept/hledger-lit · GitHub - it would make it easier for me. But we can also try and continue here.

Are there any errors printed to the console when you press "Generate expenses treemap"?

Treemap data set (map from accounts to balances) is prepared by the exact same function that is used for sankey diagrams (cash flows), so we know that this part works. So I would suspect that the hledger command used to generate balances for the treemap is somehow wrong. Can you take it out of a sidebar and run it manually, or add print(expanded_cmd)after line 547 and run the printed command and see if produces anything, and then also add print(expenses) after line 548 and see if that prints out anything as well.

I figured it out—my expenses are measured in kilograms, so they can’t be converted into currency.

2026-05-23 Preparing Mozart’s meal
Assets:inventory:Mozart:Food:Beef:Knuckle -3.0 kg
Expenses:Mozart:Food:Beef:Knuckle 3.0 kg
Assets:inventory:Mozart:Food:Beef:Heart -0.3 kg
Expenses:Mozart:Food:Beef:Heart 0.3 kg

After removing these transactions, the expense tree map works properly again.