Skip to content

Examples overview

First PublishedLast UpdatedByAtif Alam

This section holds step-by-step examples: each guide walks you through a full script (parsing, structure, tests) so you can run and extend it yourself. Most examples use the standard library only for application code. If a walkthrough elsewhere says pip install, see Environment setup.

  • Run and test first script — Scaffold a uv project, write main.py, run with uv run, verify your venv, and test with pytest (stdlib app code; pytest as dev dependency).
  • Process log files — Four steps: read logs line by line, parse with split, aggregate counts and error buckets, then print a report (stdlib only, no regex).
  • Read from API and process data — Four steps: fetch GitHub commits JSON, normalize records, summarize by author/day, and print a compact report.
  • Process cloud policies — Traverse and query cloud permissions policy documents (e.g. AWS IAM–style) with Python. Build the parser, traverser, and query helpers step by step, running and testing after each step.
  • Incident records analyzer — Filter, enrich, group, and aggregate a list of incident dicts using filter, map, a small group_by helper, and functools.reduce (stdlib only).