Pages

Topics

Tools

↑↓navigate↵openescclose

Python guides

Every published Python guide, newest first, with practical examples you can copy into your own project.

3,965 guides across 14 topics

Topics

Latest Python guides

A terminal window with a styled prompt and a table of results, illustrating Rich's interactive CLI output.
Python

Python Rich Prompts and CLI Output: A Practical Guide

Build interactive CLI prompts and styled terminal output in Python with Rich. Learn validation with Prompt.ask, tables, panels, and progress bars.

RichCLIPythonterminal
Terminal window showing Markdown, JSON, and layout panels rendered with Python Rich
Python

Python Rich: Markdown, JSON, and Layouts in the Terminal

Combine Python Rich's Markdown, JSON, and Layout renderables to build readable CLI output with syntax highlighting and responsive panels.

RichTerminal UIMarkdownJSON
A terminal window with a highlighted Python traceback and colored log lines, illustrating Rich logging output.
Python

Python Rich Logging: Tracebacks and Syntax Highlighting

Learn how to configure RichHandler for Python logging, including readable tracebacks, syntax highlighting options, and production considerations.

Richloggingtracebackssyntax highlighting
Illustration of a Python terminal with progress bars, spinners, and status indicators.
Python

Python Rich Progress Bars, Spinners, and Status

Learn how to add Rich progress bars, spinners, and status messages to Python CLI apps, with working examples and configuration details.

Richprogress barsspinnersterminal UI
A terminal window displaying a Rich table and panel with styled columns and borders.
Python

Python Rich Console: Print Tables and Panels

Render structured data as tables and panels in Python with Rich. See how to set up the console, align columns, style output, and nest renderables.

RichConsole OutputTerminal UIData Tables
Illustration of a Python Faker and pytest integration, showing a seed and generated test data cards
Python

Python Faker with Pytest Test Data

python faker with pytest test data: Learn how to use Python Faker with pytest to generate realistic test data, including fixtures, seeding for reproducibility, and com...

Fakerpytesttest datafixtures
A visual metaphor of a Python Faker data generator with a globe, a unique stamp, and a seed icon, representing locale, uniqueness, and determinism.
Python

Python Faker: Locale, Unique Values, and Seeds

Learn how Python Faker combines locale-specific data, deterministic seeds, and unique value generation for realistic test data, along with common pitfalls.

Fakertest datalocalesrandomness
Illustration of a Python Faker generator producing realistic names, emails, addresses, and dates from a code block.
Python

Generate Names, Emails, Addresses, and Dates with Python Faker

Learn how to use Python Faker to generate realistic names, emails, addresses, and dates for test data. Includes locale support, reproducible seeds, and performance tips.

FakerPythonfake datatest data
A visual metaphor for pytest coverage configuration, showing a shield with a coverage percentage gauge and a Python code snippet in the background.
Python

Python Pytest Cov Configuration and Coverage Reports

python pytest cov configuration and coverage reports: Learn how to configure pytest-cov, generate terminal, HTML, and XML coverage reports, and enforce coverage thresh...

pytestcoveragepytest-covtesting
Illustration of Python code with branch coverage report showing covered and missed branches in an HTML view.
Python

Python Coverage: Branch Coverage and HTML Reports

Learn how to measure branch coverage with Python's coverage.py, generate HTML reports, and interpret missed branches.

coverage.pybranch coverageHTML reportstesting