Real Python (@realpython) header
Real Python (@realpython) profile picture

Helping Python developers build with AI: apps, agents, models, and AI-assisted coding. Expert-reviewed tutorials and courses, read by 1M+ developers a month.

Joined August 2012
Photo by Real Python (@realpython)Photo by Real Python (@realpython)Photo by Real Python (@realpython)Photo by Real Python (@realpython)Photo by Real Python (@realpython)Photo by Real Python (@realpython)Photo by Real Python (@realpython)Photo by Real Python (@realpython)Photo by Real Python (@realpython)Photo by Real Python (@realpython)
Big news: the Real Python team just launched RealJS 🎉 Same team, same way of teaching, now for JavaScript. It's live today, and it has its own home on X: @learnrealjs 🧵
1
3
22
6,826
"Testing every edge case means writing a dozen near-copies of the same test." Not with pytest. One test function can run many scenarios. The tutorial also shows when a fixture helps and when to skip it. realpython.com/pytest-python…
1
9
1,576
That boring task you redo every Friday? Python can take it off your hands this week. Free kit: cheat sheet → working code → full video course → quiz to check yourself. realpython.com/kits/automati…
1,315
You and Claude Code both ran code in the same analysis. Which lines were yours? In Positron, code an agent runs in the console is marked as the agent's, so the history shows who ran what. Isabel Zimmerman on why that matters when you need to trust it: realpython.com/podcasts/rpp/…
2
3
6
1,380
Your function takes a pandas DataFrame. A teammate passes it a Polars one. The Narwhals library lets one function take both and return what it got: 1. pandas in, pandas out 2. No copy of your data 3. pandas keeps its index 4. Picking the output type 5. A LazyFrame trap 🧵
1
4
2,995
5. Pass a Polars LazyFrame to a Narwhals function that calls .pivot() and you get: AttributeError: 'LazyFrame' object has no attribute 'pivot' A pivot needs data a LazyFrame hasn't loaded yet. from_native(df, eager_only=True) fails up front with a TypeError instead.
1
473
Calling Meta's Muse Spark from Python? Set reasoning effort to "minimal." In the tutorial's test it cut latency by more than half and cost by about 60%, with no loss in accuracy. Open-weights Glimmer answered the same question for about 1/8 of the cost. realpython.com/meta-muse-pyt…
4
1,315
Gemini CLI and Claude Code, same prompt, three runs each: a Python to-do CLI with JSON storage and unit tests. All tests passed. Read the code, though: 1. A cut-off tasks.json 2. A blank task 3. Faster, with twice the code 4. 3, 6 or 8 files 5. Who itemizes tokens 🧵
4
3
7
4,090
5. Type /exit in Gemini CLI and you get a token breakdown. The to-do runs averaged 44,640 input and 3,772 output tokens, about $0.03 a run at API prices and $0 on the free tier. Claude Code's $20/month Pro plan doesn't split input and output tokens at session end.
1
1
465
Know Python but your project needs JavaScript? RealJS is live: same team and teaching as Real Python, 100+ courses, hundreds of exercises and an AI mentor. Three learning paths are built for Python developers. And Real Python stays right where it is 👇 realpython.com/introducing-r…
6
1,558