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
priorityfor new tasks is “medium”. - The
createdfield is always generated automatically. - The
duefield 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

