Learn Python - Free Tutorials & AI Guides

Free Python Tutorials, AI Guides & Coding Projects

Python Concurrency
uvloop Source Tour: How Cython and libuv Rewire asyncio's Event Loop

uvloop Source Tour: How Cython and libuv Rewire asyncio's Event Loop

If you have ever profiled a busy Python service and watched the bulk of CPU time go to scheduling rather than to your handlers, you already know the cheapest speed-up available: swap the event loop. The project people swap to...

Python Concurrency
Trio Source Tour: How Python's Structured Concurrency Library Really Works

Trio Source Tour: How Python's Structured Concurrency Library Really Works

If you have ever maintained a nontrivial asyncio codebase, you know the quiet failures. A task is spawned without anyone keeping a reference, and the garbage collector eats it mid-flight. An exception surfaces three layers away from the bug. A...

Python Concurrency
RQ Source Tour: How Redis Queue Executes Python Background Jobs

RQ Source Tour: How Redis Queue Executes Python Background Jobs

Your web handler has just spent nine seconds emailing three hundred users, and the request timeout is ten. Every Python team eventually hits the same wall: some work is too slow, too flaky, or too bursty to live inside a...

Python Concurrency
huey Source Tour: Inside the Zero-Dependency Python Task Queue

huey Source Tour: Inside the Zero-Dependency Python Task Queue

Every Python team eventually hits the same wall: a background job that outgrows a thread. A webhook needs a retry, a nightly report needs cron semantics, a bulk import needs to run “later” without blocking a request — and suddenly...

Python Concurrency
greenlet Source Tour: How Python's Cooperative Threads Switch C Stacks

greenlet Source Tour: How Python's Cooperative Threads Switch C Stacks

Every Python developer eventually hits the same wall. You need ten thousand concurrent tasks, OS threads cost real memory and scheduler pressure for each one, the GIL serializes the CPU-bound ones anyway, and async/await demands that you repaint your entire...

Python Concurrency
gevent Source Tour: How the Hub, Monkey Patching and Cython Accelerators Actually Work

gevent Source Tour: How the Hub, Monkey Patching and Cython Accelerators Actu...

Every Python service that spends its life waiting on the network eventually meets the same wall. You need to hold a few thousand slow connections open, or fan out requests to hundreds of endpoints, and the obvious tools stop cooperating....

Python Concurrency
Inside dramatiq: A Source Tour of the Python Task Queue's Actors, Brokers and Worker Threads

Inside dramatiq: A Source Tour of the Python Task Queue's Actors, Brokers and...

Every Python team eventually hits the same wall: an endpoint that used to respond in milliseconds now drags through image resizing, third-party calls, or a slow report, and users start refreshing the page. Moving that work off the request cycle...

Python Concurrency
How Celery Works: A Source Tour of Python's Distributed Task Queue

How Celery Works: A Source Tour of Python's Distributed Task Queue

Every Python team eventually meets the same problem: a web request needs to do something slow — send a batch of emails, transcode a video, call a third-party API that times out half the time — and doing it inline...

Python Concurrency
APScheduler Source Tour: Inside the AsyncScheduler Wake-Up Loop, CronTrigger and Data Stores

APScheduler Source Tour: Inside the AsyncScheduler Wake-Up Loop, CronTrigger ...

Every Python team eventually reinvents a scheduler, and every homegrown scheduler eventually hurts. The script that “cron plus a shell loop” was supposed to cover gets deployed to a second server, and suddenly two workers run the same report at...

Python Concurrency
AnyIO Source Tour: How One Library Runs Unmodified on asyncio and Trio

AnyIO Source Tour: How One Library Runs Unmodified on asyncio and Trio

Every asyncio library author eventually gets the same bug report: “can you support Trio?” The honest answer is usually no, and it is expensive to change. Anything built directly on asyncio.Lock, asyncio.Event, or loop.call_soon is welded to one scheduler. The...

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...

Watch PyShine on YouTube