Saltar a contenido

Python Mastery Blueprint - A 24-Week Beginner-to-Senior Syllabus (AI-Systems Track)

Authoring lens: Senior Staff AI/Platform Engineer. Target outcome: A graduate of this curriculum should be capable of (a) writing, reviewing, and shipping idiomatic, production-grade Python at a senior level, (b) reasoning about CPython internals well enough to debug GIL contention, allocator pathologies, and asyncio event-loop stalls in production, and (c) designing AI systems end-to-end - RAG services, agent orchestration platforms, training/inference pipelines - with clear opinions on the trade-offs.

This curriculum is not "Learn Python in 24 hours stretched to 24 weeks." It assumes the reader can write working code in some language. The premise: most Python performance and correctness bugs at scale are not language bugs - they are interpreter, GIL, allocator, and event-loop bugs in disguise, layered on top of glue-language assumptions about NumPy, PyTorch, and CUDA. This curriculum surfaces all of them.


Repository Layout

File Purpose
00_PRELUDE_AND_PHILOSOPHY.md The "Python-ness" of Python; the data model; the cost model; the reading list.
01_MONTH_FOUNDATIONS.md Weeks 1–4. Syntax, the data model (__dunder__), control flow, idioms, packaging basics.
02_MONTH_INTERMEDIATE_IDIOMS.md Weeks 5–8. Iterators, generators, decorators, context managers, dataclasses, the type system.
03_MONTH_RUNTIME_AND_PERFORMANCE.md Weeks 9–12. CPython internals: bytecode, eval loop, refcounting, GC, allocator, GIL, dis, sys, tracemalloc.
04_MONTH_CONCURRENCY_AND_PARALLELISM.md Weeks 13–16. threading, multiprocessing, asyncio, concurrent.futures, free-threaded 3.13+, subinterpreters, native extensions.
05_MONTH_PATTERNS_AND_ARCHITECTURE.md Weeks 17–20. Pythonic design patterns, data structures, packaging, testing, observability, FastAPI/Pydantic.
06_MONTH_AI_SYSTEMS_SENIOR.md Weeks 21–24. LLM-app architecture, RAG, agents, evals, training/serving, distributed inference, capstone.
APPENDIX_A_PRODUCTION_HARDENING.md ruff, mypy/pyright, pytest/hypothesis, profilers (py-spy, scalene, memray), packaging with uv/hatch.
APPENDIX_B_DATA_STRUCTURES_AND_PATTERNS.md Build-from-scratch reference: LRU, trie, bloom filter, ring buffer, async queue, vector index.
APPENDIX_C_DEEP_DIVE_CPYTHON_AND_AI_RUNTIMES.md The deep-dive session: CPython eval loop, asyncio internals, NumPy strides/buffer protocol, PyTorch autograd, CUDA streams.
CAPSTONE_PROJECTS.md Three terminal projects: production RAG service, agent orchestration platform, training/serving pipeline.

How Each Week Is Structured

Every weekly module follows the same five-section format so the reader can budget time:

  1. Conceptual Core - the why, with a mental model.
  2. Mechanical Detail - the how, down to CPython source where relevant (Python/ceval.c, Objects/dictobject.c, Modules/_asynciomodule.c, etc.) or to the relevant PEP.
  3. Lab - a hands-on exercise that cannot be completed without internalizing the concept.
  4. Idiomatic & Linter Drill - read 2–3 ruff/pyright rules, refactor a sample to silence them, understand why each rule exists.
  5. Production Hardening Slice - a profiling, typing, or testing micro-task that compounds into a publishable hardening template by week 24.

Each week is sized for ~12–16 focused hours. Skip the labs at your peril; the labs are the curriculum.


Progression Strategy

The phases form a dependency DAG, not a linear track:

Foundations ──► Intermediate Idioms ──► Runtime & Perf ──► Concurrency & Parallelism
     │                  │                      │                        │
     └──────────────────┴───────────┬──────────┴────────────────────────┘
                        Patterns & Architecture
                       AI Systems & Senior Design
                              Capstone Defense

The Production Hardening slice is intentionally orthogonal - it accumulates a hardening/ template that, by week 24, is a publishable Python project starter (uv-managed, ruff+pyright-clean, pytest+hypothesis, structured logging, OpenTelemetry, Dockerfile, CI).


Non-Goals

  • This curriculum does not teach data analysis as a primary subject. Pandas/Polars appear only as tools in service of AI pipelines.
  • Web-framework breadth is out of scope. We pick FastAPI + Pydantic v2 and go deep; Django/Flask appear only as comparison points.
  • "Why Python is better than X" advocacy is explicitly avoided. The reader should finish the program able to argue against using Python when it is the wrong tool (CPU-bound numeric kernels without NumPy/Cython, hard-real-time, mobile, anything where 200ms cold-start matters).

Capstone Tracks (pick one in Month 6)

  1. Production RAG Service - multi-tenant retrieval-augmented generation with hybrid search, reranking, streaming responses, evals, and a staged rollout harness.
  2. Agent Orchestration Platform - tool-using LLM agents with durable execution, retries, observability, cost ceilings, and a permissions model.
  3. Training/Serving Pipeline - fine-tune a small open model (LoRA), serve with vLLM or TGI behind a FastAPI gateway, with autoscaling, batching, and continuous evaluation.

Details in CAPSTONE_PROJECTS.md.


Versioning Note

This curriculum targets Python 3.13+ as the baseline (PEP 703 free-threaded build available, PEP 684 per-interpreter GIL stable, PEP 669 low-impact monitoring, faster CPython work from 3.11–3.13 fully landed, typing module modernized, match statements stable since 3.10, tomllib since 3.11). Where 3.14 features matter, they are flagged inline. Do not start this curriculum on a Python older than 3.12 - too many of the modern idioms and the new typing semantics will be unavailable.


Senior-Level Exit Criteria

By week 24, the graduate should be able to, in a design review:

  • Argue from CPython memory layout why a hot path allocates and how to fix it (__slots__, NumPy arrays, Cython, struct-of-arrays).
  • Diagnose GIL contention vs. I/O blocking vs. event-loop stalls from a single py-spy dump without re-running the program.
  • Design a RAG pipeline with explicit choices on chunking, embedding model, index type, reranker, and eval methodology - and defend each choice against an alternative.
  • Choose between threads, processes, asyncio, free-threaded, and subinterpreters with a one-paragraph justification per choice.
  • Run a fine-tune, evaluate it offline and online, and ship it behind a gradual rollout with cost and quality guardrails.

Print this path

Want to read offline or archive? Open the printable version - every section of this path concatenated into one page, styled for paper. Use your browser's Print → Save as PDF.