python№26
Python for JS/TS developersPYTHON
Learn Python coming from JavaScript — language core, scripting and automation, with an eye toward AI tooling.
- units
- 13
- lessons
- 45
- hours
- ~13
00
Start from zero
Why a JS/TS developer should add Python, and where it differs.01
Language core
Syntax, the built-in data structures, and how typing differs from TS.02
Scripting & I/O
Files, HTTP and packaging — enough to write a useful automation script.03
The Python data model
Everything is an object with a protocol: dunders define behaviour, descriptors power attributes, and __slots__ is the memory lever.01Dunder protocols: __repr__, the eq/hash contract, truthiness, and NotImplemented17 min02Attribute lookup and descriptors: why the instance dict does not always win19 min03Classes, dataclasses, and __slots__: generated boilerplate and the per-instance dict18 min04Iterators and generators: paused frames, lazy pipelines, and the file handle that never closed19 min
04
Typing and the modern toolchain
Type hints are a static contract the runtime ignores: mypy/pyright enforce it, generics and protocols express it, uv and ruff ship it.01Type hints as a system: unions, TypedDict, Literal, and typing the boundaries first17 min02Generics and Protocols: PEP 695 syntax, variance without hand-waving, structural typing19 min03Type checkers in anger: narrowing, strictness, Any contagion, and mypy vs pyright19 min04The 2025 toolchain: uv for environments and locking, ruff for lint and format, one pyproject.toml17 min
05
Concurrency: GIL, threads, asyncio
The GIL serializes bytecode, not I/O: threads for waiting, processes for CPU, asyncio for many sockets — free-threading changes the rules.01The GIL, honestly: what it serializes, why refcounting needs it, and what 3.13 free-threading changes18 min02Threads vs processes: choosing by workload, races under the GIL, and the fork+threads deadlock18 min03asyncio honestly: suspendable frames, await as the only switch point, and the blocking call that freezes everyone20 min04Structured concurrency: TaskGroup, except*, asyncio.timeout, and why bare create_task is a leak20 min
06
Web services: ASGI and FastAPI
ASGI is the contract, FastAPI the ergonomics: pydantic validates at the boundary, sync handlers block the loop, lifespan owns resources.01ASGI and FastAPI: the scope/receive/send contract and the one blocking call that stalls a worker18 min02Pydantic v2: parse at the boundary, trust inside — coercion, validators, and response_model filtering18 min03The request lifecycle: middleware onion, dependency resolution, lifespan, and where errors surface19 min
07
Testing with pytest
pytest is fixtures and assertions, not classes: parametrize kills copy-paste, fixtures are generators with teardown, hypothesis finds the cases you did not.08
Performance: profiling and limits
Profile before touching code: cProfile lies under threads, py-spy samples production, memory has object overhead, and some jobs are not for Python.01Profiling with cProfile and py-spy: measure the production shape before touching code18 min02Memory and objects: why an int costs 28 bytes and where the leak actually lives18 min03C extensions, honestly: the options ladder, the GIL boundary, and the marshalling tax18 min04When Python is the wrong tool: the decision tree and the salary-versus-servers arithmetic16 min
09
Data work: pandas, polars, formats
DataFrames are pragmatic, not magic: pandas vs polars honestly, parquet over csv, pipelines that validate at every boundary.01pandas and Polars, pragmatically: columnar blocks, eager vs lazy, and the pitfalls that bite in production18 min02File formats: CSV at the edges, Parquet inside — row groups, statistics, Arrow, and compression tradeoffs17 min03Pipelines and validation: contracts at boundaries, idempotent writes, and the rows that silently vanish19 min
10
Packaging and distribution
Imports are a runtime system: packages and sys.path mechanics, pyproject as the single source, lock files make installs reproducible.11
Async internals
The event loop is a scheduler you can read: task stepping, cancellation as injected exception, timeouts as scoped cancel, sync bridges.01One loop iteration, dissected: ready queue, selector poll, timer heap, and which awaits actually yield19 min02Cancellation semantics: an injected CancelledError, the bare-except immortality bug, and cleanup that must re-raise18 min03Timeouts and shielding: scoped cancel with TimeoutError conversion, deadline propagation, and shield as half a tool18 min04Bridging sync and async: to_thread and executors one way, a long-lived loop and run_coroutine_threadsafe the other18 min
12
Python in production
Production Python is logging you can query, config that fails at boot, containers built right, and postmortems of leaks and hangs.01Logging and config: the dot-name logger tree, JSON output, and settings that fail at boot19 min02Containerizing Python: slim plus multi-stage uv builds, cache-ordered layers, and signals that reach PID 118 min03Workers and lifecycle: gunicorn process math, preload and fork safety, graceful shutdown19 min04Incident postmortems: the leak, the hang, the thundering restart — and the craft of blameless analysis20 min
Build with this track
Guided projects that exercise what you learn here.
CI/CD pipelines
Ship safely on every push — pipelines, caching, and tests that gate a merge, with GitHub Actions.