Python Craft

Mission. Turn “works in my notebook” Python into professional, tested, reviewable code.

Scope

Learning objectives

Lessons

This track is scaffolded and waiting for content. See the curriculum dashboard for the roadmap and progress across all tracks.

In review — 1 draft awaiting publication

Planned lessons (23)

Wave 1 — first vertical slice (production-ready) — 23 lessons

foundations

  • Comprehensions and Generators concept · beginner · S Build collections and lazy pipelines the way fluent Python does.
  • Functions, Closures, Decorators concept · beginner · M First-class functions, captured state, and wrapping behavior without magic.
  • Error Handling That Doesn't Lie concept · intermediate · M Exceptions that carry information, and the difference between failing loud and failing wrong.
  • Dataclasses concept · beginner · S Structured records without the boilerplate, and when a dict is still fine.

typing

  • Type Hints in Practice concept · beginner · M Annotate real code: signatures, generics, and what types do and don't check.
  • Static Checking with mypy concept · intermediate · M Run mypy on a real project, read the errors, and keep the config honest.

testing

  • pytest Fundamentals concept · beginner · M Write tests that fail for the right reason and run in any order.
  • Fixtures and Parametrize concept · intermediate · M Reuse setup and cover the matrix of cases without copy-paste.
  • Testing Data Code concept · intermediate · L Test transforms, schemas, and edge cases without turning tests into brittle snapshots.
  • Property-Based Testing concept · advanced · M Generate adversarial inputs with Hypothesis and let invariants find the bugs.

performance

  • Debugging with pdb concept · beginner · S Stop print-debugging: breakpoints, stepping, and inspecting live state.
  • Profile Before Optimizing concept · intermediate · M Measure first: cProfile, line_profiler, and locating the actual bottleneck.
  • Vectorize or Rewrite example · intermediate · M A slow data script made fast, and the analysis that chose the fix.
  • Python's Memory Model for Data concept · advanced · M What Python actually holds in memory, and why big data lives in NumPy.
  • Async Python concept · advanced · M Where await pays off for data work, and where threads beat it.

engineering

  • Environments and Pinning concept · beginner · S Virtual environments, lockfiles, and installs that reproduce.
  • Project Structure and pyproject.toml concept · intermediate · M src layout, pyproject.toml, and a project another engineer can run.
  • Building a CLI concept · intermediate · M Wrap an analysis in a real command-line tool with argparse or typer.
  • Notebook Discipline concept · intermediate · M Keep notebooks runnable: kernels, seeds, exports, and the boundary to modules.
  • Refactoring Data Scripts example · intermediate · L Turn a 400-line analysis script into a testable module without losing behavior.
  • Logging for Data Work concept · intermediate · S Progress, provenance, and errors you can find after the run.

communication

  • Code Review for Data Code reference · intermediate · M A checklist for reviewing analysis code: correctness, reproducibility, honesty.
  • Git for Small Teams concept · beginner · M Branches, PRs, and a review flow that survives data projects.