Minimal toy todo.txt implementation in Python.
Set up a virtual environment if you want, however you usually do it. (One possible way described below.)
Run poetry install
.
To run:
todo <cmd> <args>
To format code, check linting, run tests etc., use the Makefile
. Just running
make
will list the targets.
This is not intended as a production project, but mostly as a source of easy exercises for pair programming interviews and as a sandbox for learning more about project setup, structure, packaging, CI and so on.
As such, it comes with absolutely no guarantee that it does anything useful or correct at all. It should not be used other than to play with.
In the spirit of eating your own dog food, the project to do list is
stored in the top-level todo.txt
. To view it, run todo list
.
- I'm aware that class
Task
and its constructor could be simplified usingattrs
, but I didn't want to require too much Python knowledge to be able to work on this. - In some ways this is deliberately a bit sloppy so as to generate opportunities for discussion and criticism.
Just one possible example of how to set things up for development, not necessarily optimal:
Poetry sets up a virtual environment and direnv automates activating it whenever I go into the project directory.
I added the following snippet to my .direnvrc
:
layout_poetry() {
if [[ ! -f pyproject.toml ]]; then
log_error 'No pyproject.toml found. Use `poetry new` or `poetry init` to create one first.'
exit 2
fi
local VENV=$(dirname $(poetry run which python))
export VIRTUAL_ENV=$(echo "$VENV" | rev | cut -d'/' -f2- | rev)
export POETRY_ACTIVE=1
PATH_add "$VENV"
}
and then put this in the local .envrc
:
layout poetry
Without doing the direnv
, you can activate the virtual environment with
poetry shell
.