Manuals / Python / Ch 6

B · StructureBeginner30 min read

6. Checkpoint A — Syntax, modules & files

Python · 52 pages source format

Before pytest and httpx, prove you can write clean Python in a proper project layout. Fix gaps before Phase C — the Playwright path assumes this baseline.

What you'll learn

  • Self-assessment
  • Project layout readiness

Pass criteria

You pass when all six are true. Audit py-journey. Fix failures this week.

  • venv activates; requirements.txt committed; no global pip installs for project deps
  • src/ + tests/ layout with 5+ pure helper functions (no I/O in unit-testable ones)
  • List comprehensions and dict .get used — not index errors on missing keys
  • JSON load/save with pathlib.Path and encoding="utf-8"
  • Can explain why indentation matters and what a module is in 60 seconds
  • Code pushed to GitHub with 3+ meaningful commits

Do this now

Mark pass/fail for each criterion in README. Fix failures before continuing.

Clear?

Code review yourself

Re-read helpers.py. Rename vague variables. Extract repeated logic. Remove dead code and print statements.

Do this now

30-minute refactor pass. Commit: "refactor: checkpoint A cleanup".

Clear?

Playwright bridge

Playwright path uses the same venv, pytest, and src/ layout. If checkpoint A is shaky, browser tests will hurt.

Do this now

Note in README: "Checkpoint A passed on [date]. Next: pytest chapter, then Playwright path for E2E."

Clear?

Checklist