Skip to main content
This page contains the business logic for the Todo CLI application.
All core operations like adding, listing, marking, and clearing tasks are defined here.

Storage

  • Tasks are stored in a file: todo_data.json
  • The format is JSON, with a list of objects:
JSON

Task structure

Each task is defined using a TypedDict for type safety and readability:
Python
  • The default priority for new tasks is “medium”.
  • The created field is always generated automatically.
  • The due field is optional and can be left blank.

Function summary

File organization

To make the code more maintainable, functions in core.py are grouped by responsibility.

Notes

  • Task IDs are incremented automatically.
  • If the storage file is missing or invalid, an empty list is returned.
  • All tasks are stored in JSON with indent=2 and ensure_ascii=False.
  • The design is modular and easy to extend to:
    • Tags or categories
    • Date reminders or recurring tasks
    • Database or cloud backends