283 points · by EnhancedJax · 1y ago · 87 comments
Other than challenging myself to learn Python, I built this mainly around the habit of budget tracking at the end of the day. (I tried tracking on-the-go, but the balance was always out of sync.) All data is stored in a single sqlite file, so you can export and process them all you want!
The app is built using the textual API for Python! Awesome framework which feels like I'm doing webdev haha.
You can check out some screenshots on gh: https://github.com/EnhancedJax/Bagels
Thanks!
Shout-out to Charmbracelet's stuff such as Glow (https://github.com/charmbracelet/glow) and Gum (https://github.com/charmbracelet/gum) for rendering markdown nicely in the terminal and for using TUI in your shell scripts
Are there any frameworks or examples of this being done?
I’ve not looked into this is years but I once had this idea that in browser terminal and I remember discovering there exists javascript xterm implementation.
For me though I was thinking the setup needs custom MFA security since public browsers or devices can be compromised. Haven’t researched yet how to somehow add that to the access.
If it worked how I’d imagine you can just walk up to any computer with a modern browser, go to your self-hosted IP, it sends you access code to phone, or uses authenticator or rsa token, something, and you get your terminal access.
Nevertheless, the TUI looks very clean and shows nicely how powerful the Textual application framework is.
[1] https://ledger-cli.org [2] https://plaintextaccounting.org
For me, I just need a way to keep track of the money. That being said, I don't care too much about how it does things under the hood.
Question: Is there a good equivalent of the Dewey Decimal system for household and/or business expenses? I like your two level breakdown in default_categories.yaml and the must/need/want system and I’m wondering what prior art you used to put that together?
I see about 800 payees for my own transactions over the past two years and while the big ticket items are easy enough to spot — my favourite grocery store, my landlord, etc. — having a taxonomy that can encompass the long tail of spending would give me confidence that I have 100% understanding of my finances.
Edit: Here’s one from some UN statisticians. Turn to page 40 of the PDF (p27 in print) for the basic structure overview:
https://unstats.un.org/unsd/classifications/Econ/Download/In...
The overview felt quite ergonomic but rebalancing the overview to maintain constant branching might be useful. Section 625 on “retail services” is very large.
I primarily built Bagels starting from my use case, so maybe some of the modelling might not suit expenses of large quantities. I haven't got to the point in life where I have to pay taxes and bills yet haha
For example from that PDF, bagels would have the classification "23490 Bread and other bakers' wares". That's under "23 Grain mill products, starches and starch products; other food products" -> "234 Bakery products".
To be able to see how often one buys grain products, and then bread products, is either funny, or an unnecessary amount of detail.
I've thought of scanning all my grocery store receipts, for example to calculate how many liters of Coca-Cola I've bought in a time period...
Great job!
If anyone is looking for tools or TUIs out there in Python or other languages we host a collection of them here [0] [1]
I ask because funny enough over the weekend I spent 4 hours writing a terminal based expense tracker with a sole focus on making it easy to see income vs expenses vs business expenses totals to make it easier for me to file quarterly and yearly taxes. It's not a TUI but it lets me put items into a category and it tallies up the amounts with counts.
It's simple input / output with CSV files that you can edit with whatever editor you want and that's the main reason I wrote it. I've been using GnuCash for almost 10 years and it's kind of inefficient to input data quickly.
It's nice to see your project on the other side of the spectrum (super polished, TUI, etc.). What's it like to quickly add in items or generate income / expense / business expense reports? Ideally I'd like to be able to open my code editor of choice and do whatever operations I need to quickly insert multiple items into multiple categories.
The TUI is the frontend for the schema. You can do all CRUD with the UI, and I designed it to be able to add multiple records quickly, with input modes and templates!
For instance, running `uvx --python 3.13 Bagels` made a temporary environment and installed all dependencies in 1.01s on my computer, and it took less than 10 seconds for the program to start after creating a database etc. Next start takes less than 2 seconds since it's cached. If I decide I want to keep using it, I can install it using the uv tool command, if not I just do nothing.
The author probably really likes uv, thus the biased instructions.
I also think uv is great, but I wouldn't mention it in the user facing installation instructions. People are used to pip/pipx, thus asking them to install yet another tool might drive potential users away.
The usual pip or pipx command should work fine. It's listed on PyPI: https://pypi.org/project/Bagels
I would only mention uv in the Development Setup section (https://github.com/EnhancedJax/Bagels?tab=readme-ov-file#dev...)
winget install --id=astral-sh.uv -e
https://docs.astral.sh/uv/getting-started/installation/#wing...It's only for dev-specifics dependencies that they are using the uv-specifics section.
You can try uv in 2 min and see if you like it or not.
But, man, Textual is such a chore to write and docs are crap. Is there HTML based TUI toolkit?
I know there’s https://github.com/vadimdemedes/ink, anything else besides it?
Maybe give it a second try haha
> I built this mainly around the habit of budget tracking at the end of the day.
I've built 3 personal financial trackers. 2 CLI based and last a web-based to be able to serve it in termux as a local android app.
Anecdote: the only thing which make it usable in the end is a joint account (most transactions are happened there) which reduced monthly transaction count to low acceptable level and did not become a chore without fancy importing from bank statements. Joint account allows to record only transfers and not individual expenses. It easily could be a separate account for small expenses, it has a low value to know which kind of grocery takes most of money.
> which make it usable in the end is a joint account (most transactions are happened there) which reduced monthly transaction count to low acceptable level
I'm not sure if I understand...
Suppose someone were to write a Python terminal app such that the docs required uv OR pipx. And it installed all its own dependencies, etc. using those mechanisms.
Would that be an acceptable way to write a useful utility these days? Or, if that person wanted to write a utility, would they get far more uptake if it were to be provided as an executable written in Rust?
I think that uv is the best so far but it doesn’t matter.
pip install uv
also works; more information: https://github.com/astral-sh/uv#installationuv run --python 3.13 --no-project --with bagels bagels
Looks very slick though, congrats on getting it to this level of polish!
However, there is some value in entering your expenses manually... either you won't; or you'll spend less so you have less to enter.