Guides

In-depth tutorials and guides for Python developers.

Build a CSV Data Analyzer

Learn to read, filter, aggregate, and write CSV data in Python using the standard library csv module — no third-party dependencies required.

min read · beginner · python

Build a Markdown to HTML Converter in Python

Learn how to convert Markdown to HTML in Python using mistune and markdown, add syntax highlighting with Pygments, and sanitize output to prevent XSS attacks.

min read · intermediate · stdlib

Build a Text Adventure Game

Create an interactive fiction game in Python using dictionaries, loops, and input handling. A step-by-step guide for beginners.

min read · beginner · python

Python Number Guessing Game — Your First Beginner Project

Learn Python by building an interactive number guessing game. Covers variables, conditionals, loops, try/except, random.randint(), input(), and int().

min read · beginner · python

Build a CLI To-Do App in Python

Learn how to build a command-line to-do app using Python's argparse module and JSON persistence.

min read · beginner · python

Build a File Organizer Script

Learn how to write a Python script that automatically organizes files by extension, pattern, or date using pathlib, shutil, and glob.

12 min read · beginner · stdlib

Build a Password Generator in Python

Learn to generate cryptographically secure passwords and memorable passphrases using Python's secrets module with clear examples.

min read · beginner · python

Modern Python Workflow with Rye and uv

Learn how uv replaces pip, venv, and more for fast Python project and package management, and what to do with an existing Rye project.

min read · intermediate · packaging

Watching File Changes with watchfiles

A practical guide to monitoring file system changes with Python's watchfiles library — covering the full API, filters, debouncing, and hot reloading workflows.

min read · intermediate · python

Running Python Apps with Granian

Learn how to use Granian, a Rust-based HTTP server for Python ASGI, RSGI, and WSGI applications with native HTTP/2 and WebSocket support.

min read · intermediate · web

Result Types and Error Handling Without Exceptions

Learn how to handle errors in Python using Result types — a functional programming pattern inspired by Rust that avoids exceptions.

min read · intermediate · python

SQLModel: SQLAlchemy Meets Pydantic

Learn how SQLModel unifies SQLAlchemy ORM and Pydantic validation in a single Python model class, with easy FastAPI integration.

10 min read · beginner · python

How to Check if a String is a Number in Python

Learn multiple ways to check if a string contains a number in Python. Includes examples for integers, floats, and handling edge cases.

min read · beginner · python

Distributed Computing with Dask

Learn how to scale your Python computations across multiple machines using Dask's distributed computing capabilities.

min read · advanced · data

Fast Serialisation with msgspec

Learn how msgspec provides high-performance serialization with zero-copy decoding and built-in validation for Python applications.

12 min read · intermediate · data

Getting Started with Polars

A practical guide to Polars, the fast DataFrame library for Python. Learn to create DataFrames, run queries, and use lazy execution.

min read · intermediate · data

Building Terminal UIs with Textual

Learn how to build rich terminal user interfaces in Python using the Textual framework. Covers widgets, layouts, CSS styling, and practical examples.

15 min read · intermediate · python

attrs vs dataclasses: A Practical Comparison

Compare Python attrs and dataclasses side-by-side—understand when to use the stdlib option versus the third-party library with more features.

12 min read · intermediate · python

Runtime Type Checking with beartype

Add runtime type safety to your Python functions with beartype—the fast, decorator-based type checker that catches type errors before they reach production.

10 min read · intermediate · python

Advanced Structural Pattern Matching

Go beyond match/case basics. Explore mapping patterns, nested structures, custom classes, and state machines.

16 min read · advanced · python

Base64 Encoding and Decoding in Python

Learn how to encode and decode Base64 data in Python using the base64 module, with practical examples.

8 min read · beginner · stdlib

Building CLIs with Click

Learn how to create command-line interfaces in Python using Click, a composable and ergonomic library.

10 min read · beginner · data

Context Variables with contextvars

Learn how to use contextvars for thread-local and task-local state in async Python. Covers ContextVar, copy_context(), and practical patterns.

12 min read · intermediate · async

Message Authentication with hmac

Learn how to use Python's hmac module to create and verify keyed-hash message authentication codes (HMAC) for data integrity and authentication.

10 min read · intermediate · stdlib

Dynamic Imports with importlib

Learn to dynamically import modules and access attributes at runtime using Python's importlib.

10 min read · intermediate · stdlib

ProcessPoolExecutor and Pool in Python

Learn how to use ProcessPoolExecutor and Pool to parallelize CPU-bound tasks. Covers pool management, mapping, and common patterns.

14 min read · intermediate · python

Thread-Safe Queues with queue.Queue

Learn how to use Python queue.Queue for thread-safe communication between threads. Covers FIFO, LIFO, and priority queues with practical examples.

12 min read · intermediate · python

Python Security Best Practices

Protect your Python apps from common vulnerabilities. Learn input validation, secure data handling, authentication, and defense-in-depth strategies.

14 min read · intermediate · python

SSL/TLS Connections with the ssl Module

Learn how to use Python's ssl module to create secure network connections, verify certificates, and configure TLS contexts for production use.

12 min read · intermediate · stdlib

Trio vs asyncio: Structured Concurrency in Python

Compare Trio and asyncio for async Python. Learn when structured concurrency matters and which library fits your project.

14 min read · advanced · async

Processing CSV Files in Python

Learn how to read, write, and process CSV files in Python using the csv module and pandas.

10 min read · beginner · data

Building APIs with FastAPI

Learn how to create REST APIs quickly with FastAPI, from basic endpoints to parameterized routes and data validation with Pydantic.

15 min read · intermediate · web

Making HTTP Requests with httpx

Learn how to make HTTP requests in Python using httpx—a modern library supporting both sync and async APIs, HTTP/2, and a requests-compatible interface.

10 min read · beginner · web

Subplots and Layouts in Matplotlib

Learn how to create multiple plots in a single figure using subplots, gridspec, and layout engines.

12 min read · intermediate · data

NumPy Arrays: The Complete Guide

Master NumPy arrays: creation, indexing, slicing, and operations for efficient numerical computing.

16 min read · intermediate · python

pandas DataFrames Explained

Master pandas DataFrames: creation, indexing, manipulation, and analysis of tabular data in Python.

16 min read · intermediate · data

pandas groupby: Split, Apply, Combine

Master pandas groupby operations to split data into groups, apply functions, and combine results for powerful data analysis.

14 min read · intermediate · data

Profiling and Optimizing Python Code

Learn how to identify performance bottlenecks in your Python code using profilers, and apply proven optimization techniques to make your programs run faster.

14 min read · intermediate · python

Data Validation with Pydantic in Python

Learn how to use Pydantic to validate data, define schemas, and create robust data models in your Python applications.

12 min read · intermediate · data

Understanding pyproject.toml

Learn how to configure Python projects using pyproject.toml, the modern standard for project metadata.

10 min read · intermediate · packaging

Abstract Base Classes in Depth

Master Python ABCs—explore advanced patterns like abstract properties, classmethods, virtual subclasses, and when to choose ABCs over Protocols.

14 min read · advanced · python

Understanding Python Bytecode

Learn what Python bytecode is, how the interpreter compiles your code, and how to inspect and optimize by understanding what happens under the hood.

14 min read · advanced · python

csv.DictReader and csv.DictWriter

Learn how to read and write CSV files using dictionaries with Python's csv.DictReader and csv.DictWriter classes.

10 min read · beginner · stdlib

Customising pickle with copyreg

Learn how to use Python's copyreg module to register custom picklers and reducers for classes, making them serializable with pickle.

10 min read · advanced · stdlib

Managing Config with python-dotenv

Learn how to use python-dotenv to manage environment variables in Python, keeping your configuration separate from your code.

8 min read · beginner · python

The GIL Explained

Understand Python Global Interpreter Lock (GIL), why it exists, and how to work around its limitations for true parallelism.

12 min read · intermediate · python

Hashing with hashlib

Learn how to use Python's hashlib module to compute cryptographic hashes, checksums, and digests for data integrity and security.

10 min read · beginner · stdlib

Working with IP Addresses in Python

Learn how to create, validate, and manipulate IPv4 and IPv6 addresses using Python built-in ipaddress module.

10 min read · intermediate · stdlib

Python's Memory Model and Reference Counting

Understand how Python manages memory internally—explore reference counting, the garbage collector, and how to write memory-efficient code.

14 min read · advanced · python

Operator Overloading in Python

Learn how to define custom behavior for Python operators in your classes using special methods like __add__, __mul__, __eq__, and more

12 min read · intermediate · python

Properties: @property, getter and setter

Learn how to use the @property decorator in Python to create managed attributes with getter, setter, and deleter methods.

10 min read · beginner · python

Generating Secrets with the secrets Module

Learn how to generate cryptographically secure random numbers, tokens, and passwords using Python's secrets module.

8 min read · beginner · stdlib

Persistent Storage with shelve

Learn how to use the shelve module for simple persistent key-value storage in Python applications.

8 min read · beginner · stdlib

Template Strings with string.Template

Learn how to use Python's string.Template class for simple, safe string substitution without the complexity of f-strings or .format().

8 min read · beginner · stdlib

Creating and Extracting Archives with tarfile

Learn how to create, read, and extract tar archives using Python's tarfile module with practical examples.

8 min read · beginner · stdlib

Generic Types and TypeVar in Python

Master Python generics with TypeVar, Generic, and parametric polymorphism to write flexible, type-safe code that works with any data type.

14 min read · advanced · python

Compressing Data with zlib

Learn how to compress and decompress data using Python's zlib module, the foundation for gzip and other compression formats.

8 min read · beginner · stdlib

Working with JSON in Python

Learn how to read, write, and manipulate JSON data in Python using the json module.

10 min read · beginner · data

Making HTTP Requests with requests

Learn how to make HTTP requests in Python using the requests library—GET, POST, headers, and error handling.

10 min read · beginner · web

Beautiful Terminal Output with Rich

Learn how to create stunning terminal output in Python using the Rich library, including colored text, tables, progress bars, and more.

8 min read · beginner · data

Building CLIs with Typer

Learn how to create elegant command-line interfaces in Python using Typer, built on Click and type hints.

10 min read · beginner · data

Python Virtual Environments

Learn how to create and manage isolated Python environments for your projects.

8 min read · beginner · packaging

Web Scraping with BeautifulSoup

Learn the fundamentals of web scraping in Python using BeautifulSoup—parsing HTML, navigating the DOM, and extracting data.

12 min read · beginner · web

Abstract Base Classes with abc

Learn how to use Python abc module to define abstract base classes that enforce method implementation in subclasses

12 min read · intermediate · python

Async/Await Patterns in Python

Master async/await patterns in Python—retry logic, timeouts, batching, and error handling for production async code.

14 min read · intermediate · async

The Descriptor Protocol

Learn how Python descriptors let you customize attribute access, create reusable property logic, and build more expressive classes.

15 min read · advanced · python

Getting Started with asyncio

Learn asyncio basics—Python's library for async code. Covers coroutines, the event loop, and running concurrent operations.

15 min read · intermediate · async

Building CLI Tools with argparse

Learn how to create command-line interfaces in Python using the argparse module.

12 min read · beginner · stdlib

Working with Environment Variables in Python

Learn how to read, write, and manage environment variables in your Python applications.

8 min read · beginner · python

Python Logging for Beginners

Learn how to use Python logging effectively for debugging and monitoring your applications.

12 min read · beginner · stdlib

Logging Best Practices in Python

Take your Python logging to the next level with advanced configuration, handlers, structured logging, and production-ready patterns.

12 min read · intermediate · stdlib

Multiprocessing in Python

Learn how to use Python multiprocessing to run code in parallel using multiple processes. Covers Process, Pool, shared memory, and synchronization.

14 min read · intermediate · async

Mocking in pytest

Learn how to replace real objects with mocks in pytest to isolate code under test, control dependencies, and test edge cases.

14 min read · intermediate · testing

Structural Subtyping with Protocol

Learn how Protocol classes in Python enable structural subtyping, letting you define interfaces without inheritance for flexible duck typing

10 min read · intermediate · python

Getting Started with pytest

Learn how to write and run tests with pytest, the most popular testing framework in Python. Cover fixtures, assertions, and best practices.

12 min read · beginner · testing

Recipes with itertools

Practical patterns and recipes for working with Python's itertools module for efficient iteration.

14 min read · intermediate · stdlib

Understanding Metaclasses in Python

Dive deep into Python metaclasses—understand what they are, how they work, and when to use them to control class creation.

18 min read · advanced · python

Regular Expressions with the re Module

Learn to use Python regular expressions for pattern matching, searching, and text manipulation.

14 min read · intermediate · stdlib

Running External Commands with subprocess

Learn how to run external commands from Python, handle their output, and manage process lifecycles effectively.

10 min read · intermediate · stdlib

SQLite in Python with the sqlite3 Module

Learn how to create, query, and manage SQLite databases using Python's built-in sqlite3 module.

12 min read · beginner · stdlib

Threading in Python

Learn how to use Python threading for concurrent execution. Covers Thread, Lock, Queue, and practical patterns for I/O-bound tasks.

14 min read · intermediate · async

Unit Testing with unittest

Learn Python built-in unittest framework for writing and running unit tests. Covers TestCase, assertions, fixtures, and test organization.

12 min read · beginner · testing

Python Enums: The enum Module

Learn how to use Python enums to create sets of named constants with type safety and semantic meaning.

10 min read · beginner · python

f-strings: Python's String Formatting Power Tool

Learn how to use f-strings for readable, efficient string formatting in Python.

10 min read · beginner · python

Functional Programming Patterns in Python

Learn functional programming patterns in Python: higher-order functions, map/filter/reduce, lambdas, comprehensions, and more.

14 min read · intermediate · python

A Practical Guide to functools.lru_cache in Python

Learn how to use lru_cache to memoize function results and speed up your Python code with practical examples.

8 min read · beginner · stdlib

Structural Pattern Matching with match/case

Learn how to use Python's match/case statements for powerful pattern matching. Covers literals, wildcards, or patterns, and class patterns.

12 min read · intermediate · python

File Paths with pathlib

Learn how to work with file paths elegantly using Python's pathlib module.

10 min read · beginner · stdlib

Closures and Variable Scoping in Python

Learn how closures work in Python, understand variable scope, and see practical examples.

12 min read · intermediate · python

Building APIs with Litestar

A practical guide to building REST APIs with Litestar, covering route handlers, request validation, dependency injection, and application structure.

8 min read · beginner · python

Using namedtuple and NamedTuple in Python

Learn how to create lightweight, immutable record types using namedtuple and NamedTuple from the Python standard library.

8 min read · beginner · stdlib

Using __slots__ for Memory Efficiency in Python

Learn how __slots__ can reduce memory usage and improve attribute access speed in your Python classes.

10 min read · advanced · python

Type Hints in Python

Learn how to add type hints to your Python code for better readability and tooling support.

12 min read · intermediate · python

Sorting in Python: The key= Parameter

Learn how to use Python's key parameter for custom sorting with sorted() and list.sort(). Covers lambda functions, itemgetter, attrgetter, and multiple keys.

8 min read · beginner · python

The Walrus Operator (:=) in Practice

Learn Python walrus operator for assigning values in expressions. Covers list comprehensions, while loops, and common patterns.

8 min read · beginner · python

Context Managers and the with Statement

Learn how Python's with statement and context managers handle resource cleanup reliably, with class-based and decorator-based examples

12 min read · intermediate · python

Controlling Docker from Python

Learn how to use the Docker SDK for Python to automate container management, including listing, running, building, and managing containers.

12 min read · intermediate · stdlib

Reading and Writing YAML in Python

Learn how to read and write YAML files in Python using the PyYAML library, with examples for configuration files, nested data, and safe loading

12 min read · beginner · stdlib

Error Handling with try/except

Learn how to handle errors gracefully in Python with try/except blocks, multiple exceptions, else/finally, and best practices.

10 min read · beginner · python

List Comprehensions in Python

Learn how to use list comprehensions to create lists concisely, with examples of filtering, nested loops, and when to prefer a regular for loop.

10 min read · beginner · python

Getting Started with Dataclasses

Learn how to use Python dataclasses to write cleaner, more maintainable classes for storing data — with examples of defaults, immutability, and validation

10 min read · beginner · python

Python Decorators Explained

Learn how decorators work in Python, from basic function wrappers to parameterized decorators with practical examples for timing, logging, and caching

15 min read · intermediate · python

Virtual Environments and pip

Learn how to create isolated Python environments with venv and manage dependencies with pip — essential skills for any Python project

12 min read · beginner · packaging

Working with Files in Python

Learn how to read from and write to files in Python using built-in functions like open(), read(), write(), and context managers.

10 min read · beginner · python

Building a TCP Server and Client in Python

Learn how to build TCP servers and clients in Python using the socket module, with threading for multiple connections.

15 min read · intermediate · web

Understanding Python Generators

A complete guide to generators, yield expressions, and building memory-efficient data pipelines in Python

12 min read · intermediate · python