CLI planner project (1/6): brief and folder layout
Lock the scope of a planner CLI before you code: functional goals, the src/ layout, the JSON event format, and success criteria. Twelve exercises.
Getting started
Home Assistant
Buying
Lock the scope of a planner CLI before you code: functional goals, the src/ layout, the JSON event format, and success criteria. Twelve exercises.


AI-generated illustration
Some links on this page are affiliate links. The button opens Amazon so you can check today’s price.
Before you write code, you fix the scope: what to build, for whom, with which data and which files. This first article is the brief for the planner CLI: manage events (title, start date and time, optional duration, note), store them in a single JSON file per user (default path ~/.agenda/agenda.json or ./data/agenda.json, whichever you document), and support commands: add, list by date range, delete by identifier.
Project hub: intermediate Python planner CLI.
2026-03-29T14:00:00) or a simpler format that you document.id (UUID or an incrementing integer — pick one and justify it).agenda_cli/
pyproject.toml (optional for this course; requirements.txt is enough)
README.md
src/
agenda_cli/
__init__.py
__main__.py (entry point: python -m agenda_cli)
model.py (data structures / minimal validation)
storage.py (JSON read and write + pathlib)
service.py (business logic)
cli.py (argparse)
tests/
test_model.py
This split prepares unit tests without launching the CLI every time.
Each event is a JSON object with at least: id, title, start (ISO string), duration_minutes (integer or null), note (string, may be empty). The file root is an object with an events key: a list of objects.
The solutions are indicative; adapt them to your format choices.
Exercise 1 — In three sentences, write the user goal of the planner CLI. Easy
Example: see upcoming appointments from the terminal; add them without a graphical interface; store everything locally in a portable JSON file.
Exercise 2 — List two risks if all the code sits in a single main.py. Easy
# Hard to test; no reuse; UI, persistence, and business rules mixed together.
Exercise 3 — Propose a valid JSON example with 2 events and the events key. Easy
{
"events": [
{"id": "1", "title": "Meeting", "start": "2026-03-29T10:00:00", "duration_minutes": 60, "note": ""},
{"id": "2", "title": "Swim", "start": "2026-03-30T18:00:00", "duration_minutes": null, "note": "pool"}
]
}
Exercise 4 — Justify UUID for id versus auto-incrementing integers. Intermediate
UUID: unique without a central coordinator if you merge files; integers: easier to read on a small local project.
Exercise 5 — Success criterion: how do you check, without a graphical interface, that “list between two dates” works? Intermediate
Automated tests on service.list_between(d1, d2) with in-memory data or a temporary file.
Exercise 6 — Name one path to exclude from the Git repository for the virtual environment. Easy
.venv/
Exercise 7 — Which PEP recalls the order of imports? (an intermediate reminder). Easy
PEP 8 (imports section)
Exercise 8 — Write the outline of a README: venv install, how to launch, main commands. Intermediate
# Planner CLI
## Installation
python -m venv .venv && pip install -e .
## Usage
agenda add … / python -m agenda_cli …
Exercise 9 — Define a business error (for example an overlap) that you can postpone to v2 instead of v1. Hard
V1: no overlap detection; V2: a warning or a refusal.
Exercise 10 — An optional config file sketch: why separate the data path from the code? Intermediate
User paths without rebuilding; tests can use a temporary directory.
Exercise 11 — A table feature → module (model / storage / service / cli). Hard
Field validation → model; read and write the file → storage; list and delete rules → service; argparse → cli.
Exercise 12 — Definition of Done: three criteria before you move on to part 2. Hard
Tree created; sample JSON checked by hand; README with the planned commands.
Data, pathlib, and loading JSON
Check today’s price on Amazon
Was this page helpful?
Thank you!
What should we improve?
Torn between two models or stuck on a build? Drop us a line and we will get back to you by email.
Cookies and analytics
We use Google Analytics 4 to understand how the site is used (page views, navigation). It is only switched on if you accept. Declining does not stop you using the site. More: cookie settings and privacy policy (in French).