Learn Python - Free Tutorials & AI Guides

Free Python Tutorials, AI Guides & Coding Projects

Python CLI Tools
Typer Source Tour: How Type Hints Become Click Commands

Typer Source Tour: How Type Hints Become Click Commands

Every Python developer has felt the argparse tax: adding one option means touching the add_argument call, the help string, the type converter, and the function that finally uses the value. Four edit sites for one flag, and they drift. The...

Python CLI Tools
Textual Architecture: A Source Tour of the Python TUI Framework

Textual Architecture: A Source Tour of the Python TUI Framework

Every developer eventually needs a real terminal interface: a dashboard that survives SSH, an installer with live logs, a REPL companion, a database browser. For years the honest options were curses (archaic API, zero layout engine) or hand-rolled ANSI escape...

Python CLI Tools
Rich Source Tour: How Python's Rich Library Renders Text to Your Terminal

Rich Source Tour: How Python's Rich Library Renders Text to Your Terminal

Every Python developer has been burned by terminal output at least once. A 40-line traceback scrolls past in monochrome and the interesting frame is gone before you can read it. You print() a nested dict and get a wall of...

Python CLI Tools
Python Fire Source Tour: How Google Turns Any Python Object Into a CLI

Python Fire Source Tour: How Google Turns Any Python Object Into a CLI

Every developer has been here: you built a working Python module — a class with a few methods, or a script with three functions — and someone asks “can I run this from the shell?” The honest answer used to...

Python CLI Tools
How pyinstrument Works: A Source Tour of Python's Statistical Profiler

How pyinstrument Works: A Source Tour of Python's Statistical Profiler

Your API endpoint takes 900 ms and every unit test still passes. You reach for the standard library profiler, rerun the request, and the numbers come back warped: because cProfile hooks every single call and return, its overhead reshapes the...

Python CLI Tools
py-spy Source Tour: How a Rust Sampling Profiler Reads Live Python Stacks

py-spy Source Tour: How a Rust Sampling Profiler Reads Live Python Stacks

Every Python operator eventually meets the same 3 a.m. incident: a worker process is pegged at 100% CPU, requests are timing out, and nobody can say which function is burning the cores. If that worker is part of a django...

Python CLI Tools
PuDB Source Tour: How Python's Full-Screen Terminal Debugger Works

PuDB Source Tour: How Python's Full-Screen Terminal Debugger Works

Every Python developer eventually hits the same wall: the bug reproduces only on the cluster login node, inside a Docker container, or on a machine where the only interface is an SSH session with eighty columns and no mouse. There...

Python CLI Tools
ptpython Source Tour: How the Advanced Python REPL Really Works

ptpython Source Tour: How the Advanced Python REPL Really Works

Every Python developer knows the pain. The stock python prompt gives you no syntax highlighting, no real multiline editing, and a Control-C that can wipe out half-finished state. Dropping into a debugger inside a running service, you cannot bolt a...

Python CLI Tools
python-prompt-toolkit Source Tour: How the Terminal UI Library Behind IPython Actually Works

python-prompt-toolkit Source Tour: How the Terminal UI Library Behind IPython...

Every developer has felt the gap. You type python, you get readline: one line, weak completion, and a history that forgets itself the moment you embed the interpreter. You want a fuzzy file search box, a multiline editor with undo,...

Python CLI Tools
Click Internals: How Python's Favorite CLI Library Parses argv

Click Internals: How Python's Favorite CLI Library Parses argv

Every Python developer eventually writes a command line tool, and most of us learn the same lesson twice: argparse is fine until you have subcommands, nested groups, prompts, progress bars, and shell completion — then the boilerplate eats your afternoon....

Python Data Science
Zarr Python 3 Source Tour: How Chunked Array Storage Really Works

Zarr Python 3 Source Tour: How Chunked Array Storage Really Works

Your multi-terabyte simulation output lives in an object store, and every plot starts with the same four-minute wait: a monolithic science file must be partially fetched, parsed, and decoded before a single map can render. The classic fix — slicing...

Python Data Science
xarray Source Tour: Dataset, DataArray and the Lazy Backends Behind Labeled N-D Arrays

xarray Source Tour: Dataset, DataArray and the Lazy Backends Behind Labeled N...

If you have ever wrestled with a 40-year climate reanalysis dataset stored as hundreds of NetCDF files, you know the exact pain: arrays where axis 0 is time, axis 1 is latitude, axis 2 is longitude — and every consumer...

Python Data Science
PyTables Source Tour: How the Hierarchical HDF5 Database Layer Really Works

PyTables Source Tour: How the Hierarchical HDF5 Database Layer Really Works

Every data engineer eventually hits the same wall. You have a few hundred million numeric records, you try to hold them in a DataFrame, and the process balloons to twenty gigabytes of RAM before the first query finishes. You try...

Python Data Science
PyMC Source Tour: Model Graphs, NUTS Internals and the pm.sample() Engine

PyMC Source Tour: Model Graphs, NUTS Internals and the pm.sample() Engine

Every Bayesian workflow eventually hits the same wall: pm.sample() runs for a while, prints a progress bar, and hands back an object full of numbers. The moment divergences appear, or a chain stalls at max tree depth, or a model...

Python Data Science
Numexpr Source Tour: Compiling NumPy Expressions Into 4-Byte Bytecode

Numexpr Source Tour: Compiling NumPy Expressions Into 4-Byte Bytecode

Every data scientist eventually hits the same wall. You write a filter like (a > 0) & (b < 1) over a ten-million-element NumPy array, and Python does something quietly devastating: it allocates a full temporary boolean array for a...

Python Data Science
How joblib Works: Parallel Dispatch, Memmapped Arrays and the Memory Cache

How joblib Works: Parallel Dispatch, Memmapped Arrays and the Memory Cache

You kick off a grid search, walk away for coffee, come back, and the CPU monitor says one core is busy while thirty sit idle. The culprit is rarely your model code; it is the glue around it. joblib is...

Python Data Science
h5py Source Tour: How Cython Binds Python to the HDF5 Binary Format

h5py Source Tour: How Cython Binds Python to the HDF5 Binary Format

Every scientist who has outgrown np.save eventually meets the same wall. NumPy arrays live in memory and die with the process; the moment your data is tens of gigabytes, or several processes need to write it at once, or a...

Python Data Science
CVXPY Source Tour: How Problem.solve Compiles Convex Models into Solver Matrices

CVXPY Source Tour: How Problem.solve Compiles Convex Models into Solver Matrices

Every CVXPY user knows the moment: six lines of Python describing a portfolio optimizer or a regularized least-squares fit, prob.solve() returns a number, and nobody asks how. The question arrives later — when the compile step eats seconds on every...

Python Data Science
Astropy Architecture: A Source Tour of Units, Coordinates, FITS and Time

Astropy Architecture: A Source Tour of Units, Coordinates, FITS and Time

In 1999 NASA lost the Mars Climate Orbiter because one team fed pound-force-seconds into software that expected newton-seconds. Every developer who writes scientific code carries that story in the back of their head, because unit bugs are silent: the numbers...

Python Data Science
ArviZ Source Tour: The Metapackage Behind Python Bayesian Diagnostics

ArviZ Source Tour: The Metapackage Behind Python Bayesian Diagnostics

If you have ever fitted a Bayesian model with PyMC, NumPyro or Stan, you have almost certainly leaned on ArviZ to compute R-hat, effective sample size, LOO or a trace plot. And if you manage environments for a research group,...

Python Networking
websockets Source Tour: Sans-I/O Protocol, Frames, and the RFC 6455 Handshake in Python

websockets Source Tour: Sans-I/O Protocol, Frames, and the RFC 6455 Handshake...

Every Python developer who has shipped a realtime feature has met the same three bugs. First, the connection that dies silently behind a load balancer because nobody configured keepalive pings, and the client sits waiting forever on a dead socket....

Python Networking
Uvicorn Source Tour: Inside the ASGI Server That Runs FastAPI

Uvicorn Source Tour: Inside the ASGI Server That Runs FastAPI

Every FastAPI project ends its tutorial with the same incantation: uvicorn main:app --reload. You type it a thousand times without thinking, and then production bites you — a graceful shutdown hangs until the orchestrator force-kills the pod, a worker dies...

Python Networking
urllib3 Architecture Explained: Connection Pools, Retry Backoff and TLS from the Source

urllib3 Architecture Explained: Connection Pools, Retry Backoff and TLS from ...

Every Python developer ships urllib3 whether they know it or not. It is the engine underneath pip, the layer that requests wraps, and a direct dependency of botocore, google-auth, and a long list of SDKs. So when an endpoint starts...

Python Networking
Starlette Source Tour: The ASGI Routing Engine Behind FastAPI

Starlette Source Tour: The ASGI Routing Engine Behind FastAPI

Every FastAPI developer has met Starlette without being introduced. The HTTPException you raise, the Request object you annotate, the BackgroundTasks you inject, the 405 that appears when you POST to a GET-only route — all of that surfaces from Starlette,...

Watch PyShine on YouTube