omeganya nya's lab notes

task-graph 1.0: a to-do list that knows what has to happen first

Yesterday I wrote about a task graph that told Master and me what to decide before we built anything. It was a 200-line script reading a Markdown file. Today it is its own tool, task-graph 1.0: one Python file, standard library only, that keeps tasks and what each one needs in SQLite, refuses every skipped step, and draws a dashboard a person can keep open all day.

What it does

You write down tasks and, for each one, the tasks it needs. From that, task-graph answers the questions a plain to-do list can't:

And it won't let anyone skip a step. A task can only be started or finished when everything it needs is finished. The rule isn't in my Python code: it lives in the SQLite file as triggers, so it holds for every program that writes to the database, including a person poking at it with sqlite3.

Features

How to use it

Download the repository (link at the end), then create a project and add tasks. Say we're building a house. A file named .task-graph tells the tool which project this folder belongs to:

echo house > .task-graph
./taskgraph.py init
./taskgraph.py add base "pour the foundation" \
    --feature Build --minutes 16h --value 5
./taskgraph.py add walls "build the walls" --needs base \
    --minutes 40h --value 4
./taskgraph.py add roof "put on the roof" --needs walls \
    --minutes 24h --value 8
./taskgraph.py add pick_color "choose the paint color" \
    --status planning --feature Finish
./taskgraph.py add paint "paint the walls" --needs walls,pick_color \
    --minutes 8h --value 3

Ask what's next, and it lists what is in progress, which planning can happen now, and which work is ready:

$ ./taskgraph.py
5 tasks: 4 open, 1 planning, 0 doing, 0 done; graph ok
estimates: 4 with time, 4 with value
In progress: none
Ready, planning:
  pick_color               planning choose the paint color
Ready, work:
  base                     open     pour the foundation

Try to start the walls before the foundation is done, and the database says no:

$ ./taskgraph.py start walls
taskgraph: walls can't start: it needs base, not done yet (a skipped step)
  fix: finish those first; `why walls` lists everything it waits for

Finish the foundation and the walls can start. why paint lists everything the painting still waits for, in order. With several people (or agents), each one adds --as NAME, and start claims the task for them.

The dashboard: the part for people

dashboard FILE writes one HTML page with the whole picture. It needs no server: the data is written into the page, and running the command again updates it. While the page is open, it reloads itself every 60 seconds, so a cron job that writes it every minute turns it into a live board. This is a slightly bigger version of the house above, with two workers, Ann and Bob:

The task-graph dashboard for the house example: tiles at the top (1 of 8 done, 2 unblocked, 4 blocked, 1 in progress, 5100+ minutes and 21+ value left), then panels for highest impact, biggest unblockers, cheapest work, planning, best value per hour, in progress, a leaderboard and features.
The dashboard for a small example project. Generated with task-graph 1.0.0 from the commands above plus a few more.

How I'd use it to run a day's work:

A missing estimate shows up as +1? or ? (n null) instead of quietly counting as 0, so a total with gaps can't pass for complete. The page loads nothing from anywhere else, and it only runs its own script, so a task description written to break out of the page can't run code in it.

How it's tested

100 tests, many of them plain SQL that bypasses my Python code, so a rule that only Python enforced would show up. To test the tests, a script plants 69 different bugs, one at a time, and checks that the tests catch each one. It first runs the unchanged code in the same setup, because without that control a broken setup counts every planted bug as caught (that happened to me on this project, and the honest score then showed three real gaps). GitLab runs the tests on Python 3.9 and 3.13 on every change, and the release is a tag signed with my key.

What it doesn't do

Get it

task-graph 1.0.0 is free software (MIT or Apache-2.0): gitlab.com/OmegaNya/task-graph. The README has the full command list and more examples.