OIDIA
Posted on 2022-12-16 09:30 +0000 in Python • Tagged with Python, coding, Textual, PyPi • 2 min read
Another little thing that's up on PyPi now, which is the final bit of fallout from the Textual dogfooding sessions, is a little project I'm calling OIDIA.
The application is a streak tracker. I'm quite the fan of streak trackers. I've used a few over the years, both to help keep me motivated and honest, and also to help me track that I've avoided unhelpful things too. Now, most of the apps I've used, and use now, tend to have reminders and counts and stats and are all about "DO NOT BREAK THE STREAK OR ELSE" and that's mostly fine, but...
To keep things simple and to purely concentrate on how to build Textual apps, I made this a "non-judgement" streak tracker. It's designed to be really simple: you add a streak, you bump up/down the number of times you did (or didn't do) the thing related to that streak, for each day, and that's it.
No totals. No stats. No reminders and bugging. No judgement.
Here it is in action:
When I started it, I wasn't quite sure how I wanted to store the data. Throwing it in a SQLite database held some appeal, but that also felt like a lot of faff for something so simple. Also, I wanted to make the data as easy to get at, to use elsewhere, and to hack on, as possible. So in the end I went with a simple JSON file.
On macOS and GNU/Linux streaks.json
lives in ~/.local/share/oidia
, on
Windows it'll be in... I'm not sure off the top of my head actually; it'll
be in whatever directory the handy xdg
library has chosen. and because it's JSON
that means that something like this:
ends up looking like this:
[
{
"title": "Hack some Python",
"days": {
"2022-12-02": 1,
"2022-12-03": 1,
"2022-12-04": 1,
"2022-12-05": 1,
"2022-12-06": 1,
"2022-12-07": 1,
"2022-12-08": 1,
"2022-12-01": 1,
"2022-11-30": 1,
"2022-11-29": 1,
"2022-11-28": 1
}
},
{
"title": "Brush my teeth",
"days": {
"2022-12-02": 2,
"2022-12-03": 2,
"2022-12-04": 2,
"2022-12-05": 2,
"2022-12-06": 2,
"2022-12-07": 2,
"2022-12-08": 1,
"2022-12-01": 2,
"2022-11-30": 2,
"2022-11-29": 2,
"2022-11-28": 2
}
},
{
"title": "Walk",
"days": {
"2022-12-02": 1,
"2022-12-03": 1,
"2022-12-04": 1,
"2022-12-05": 1,
"2022-12-06": 1,
"2022-12-07": 1,
"2022-12-08": 1,
"2022-12-01": 1,
"2022-11-30": 1,
"2022-11-29": 1,
"2022-11-28": 1
}
},
{
"title": "Run 5k",
"days": {
"2022-12-03": 2,
"2022-12-05": 1,
"2022-11-30": 1,
"2022-11-28": 2
}
},
{
"title": "Run 10k",
"days": {
"2022-12-03": 1,
"2022-11-28": 1
}
}
]
Of course, it remains to be seen how well that actually scales; possibly not so well over a long period of time, but this was written more as another way to explore Textual than anything else. Even then, it would be pretty trivial to update to something better for holding the data.
If this seems like your thing (and I will be supporting it and onward
developing it) you can find it over on
PyPi, which means it can be installed with
pip
or the ever-handy pipx
:
$ pipx install oidia