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.

Illustration : étudiante dessinant la maquette d'un agenda sur une grande feuille avec des notes adhésives, ordinateur portable ouvert à côté

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.

Functional goals

  1. Add an event with an ISO 8601 date (2026-03-29T14:00:00) or a simpler format that you document.
  2. List events between two dates (inclusive).
  3. Delete an event by a stable id (UUID or an incrementing integer — pick one and justify it).
  4. Errors: clear messages if the file is missing (first run), the JSON is corrupt, or the date is invalid.
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.

Data model (draft)

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.

Exercises (12)

The solutions are indicative; adapt them to your format choices.

Application

Exercise 1 — In three sentences, write the user goal of the planner CLI. Easy

Show the solution
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

Show the solution
# 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

Show the solution
{
  "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

Show the solution
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

Show the solution
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

Show the solution
.venv/

Exercise 7 — Which PEP recalls the order of imports? (an intermediate reminder). Easy

Show the solution
PEP 8 (imports section)

Exercise 8 — Write the outline of a README: venv install, how to launch, main commands. Intermediate

Show the solution
# 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

Show the solution
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

Show the solution
User paths without rebuilding; tests can use a temporary directory.

Exercise 11 — A table feature → module (model / storage / service / cli). Hard

Show the solution
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

Show the solution
Tree created; sample JSON checked by hand; README with the planned commands.

Next

Data, pathlib, and loading JSON

Amazon

Check today’s price on Amazon

Further reading

Was this page helpful?

Have a question about this guide or need advice? Ask us here

Torn between two models or stuck on a build? Drop us a line and we will get back to you by email.