#python
89 pages tagged python.
uv vs pip
How the uv toolchain compares to classic pip for Python package management.
AWS CLI
Drive every AWS service from a terminal. Covers install (pip vs v2 installer), aws configure, profiles, SSO, day-to-day commands across S3 / EC2 / Lambda / IAM / STS, common scenarios, and credential precedence.
beets Music Organizer
Importing, tagging, querying, and organizing a music library with beets — config, plugins, queries, and common workflows on Windows.
Virtual Environments
Create, activate, and manage Python virtual environments with venv. Covers activation for every shell, pip usage, requirements files, and cleanup.
uv
Install packages and manage virtual environments blazingly fast with uv. Covers uv pip, uv venv, uv run, uv init, and how it compares to pip and poetry.
typing
Go beyond list[int] and str | None. Covers Protocol, TypeVar bounds, ParamSpec, Concatenate, Self, Annotated, TypedDict with NotRequired/Required, TypeAlias, TypeGuard, TypeIs, cast, assert_type, and reveal_type.
subprocess
Run external commands from Python with subprocess. Covers run vs Popen, capture_output, streaming, pipes, timeouts, env/cwd overrides, and shlex quoting safety.
streamlit
Build interactive web apps for data and ML in pure Python. Covers widgets, layout, session state, caching, multipage apps, and deployment patterns.
Semantic Kernel
Build LLM-powered applications with Microsoft Semantic Kernel. Covers the kernel, plugins, prompt templates, planners, function calling, Kernel Memory, Python and .NET SDKs.
scikit-learn
Build classical ML pipelines with scikit-learn. Covers the estimator API, train_test_split, Pipeline, ColumnTransformer, cross-validation, metrics, and model persistence.
requests
Make HTTP requests in Python with the requests library. Covers GET/POST, JSON, sessions, authentication, retries, and common pitfalls.
re
Python's built-in regex module — compile vs not, match/search/findall/finditer/sub, named groups, lookarounds, verbose mode (re.X), and how it differs from PCRE.
Python Installation
Choose your OS and get Python installed in minutes. Covers Windows, WSL/Ubuntu, macOS, and Linux with recommended versions and verification steps.
Python Installation
Install Python 3 inside WSL2/Ubuntu via apt, the deadsnakes PPA, or pyenv. Covers the python3-venv quirk and version aliasing.
Python Installation
Install Python 3 on Windows via winget or the python.org installer. Covers PATH setup, the py launcher, and verification steps.
Python Installation
Install Python 3 on macOS via Homebrew or pyenv. Explains the system-Python warning, PATH precedence, and verification steps.
Python Installation
Install Python 3 on Debian/Ubuntu, Fedora/RHEL, and Arch Linux. Covers package managers, pyenv, and building from source for unsupported distros.
pyproject.toml
The canonical config file for modern Python projects — [project] metadata, [build-system] backends (setuptools, hatchling, pdm-backend, poetry-core, flit-core), [tool.*] sections, dynamic versioning, scripts, building, and publishing.
pydantic
Validate and parse data at runtime using Python type hints with Pydantic v2. Covers BaseModel, field validators, nested models, and JSON serialization.
pre-commit
Run linters, formatters, and validators automatically on every git commit. Covers .pre-commit-config.yaml, essential hooks (ruff, mypy, check-yaml), autoupdate, and CI integration.
poetry
Manage Python project dependencies, virtual environments, and package publishing with Poetry. Covers pyproject.toml, lockfiles, groups, and publishing to PyPI.
pip vs uv
Side-by-side feature comparison of pip and uv — speed, lock files, virtual envs, Python version management, and when to use each.
Pip Packages
Cheat sheets for third-party PyPI packages — HTTP clients, data tools, validation, terminal UIs, and more.
pdb
Pause, inspect, and step through Python programs with pdb. Covers breakpoint(), command reference, post-mortem debugging, conditional breakpoints, and enhanced alternatives like ipdb, pdbpp, and pudb.
MCP Frameworks
Model Context Protocol (MCP) framework overview. Covers client/server architecture, stdio vs SSE vs streamable HTTP transports, FastMCP, mcp-go, the Python and TypeScript SDKs, and comparison with custom tool servers.
logging
Configure Python's built-in logging module — loggers, handlers, formatters, dictConfig, rotation, structured records, and how it compares to loguru.
json
Encode and decode JSON in Python with the stdlib json module. Covers dumps/loads, indent/sort_keys/separators, custom default= and JSONEncoder, object_hook decoding, JSONL streaming, and orjson/ujson/msgspec comparison.
itertools & functools
The two stdlib modules every Python developer pairs together — iterator algebra (chain, groupby, batched, pairwise) and function plumbing (lru_cache, partial, reduce, singledispatch, cached_property).
httpx
Make sync and async HTTP requests with httpx. Covers GET/POST, async usage, HTTP/2, streaming, and how it compares to requests.
Haystack 2.x
Build production-grade LLM pipelines with Haystack 2.x. Covers components, the pipeline graph, indexing and querying, retrievers, generators, RAG patterns, and evaluation.
flask
Build lightweight web apps and REST APIs with Flask. Covers routes, request handling, JSON responses, blueprints, and the debug-server warning.
fastapi
Build high-performance async REST APIs with FastAPI. Covers path params, request bodies, Pydantic models, dependency injection, and auto-generated OpenAPI docs.
Essential Python Packages
Overview of the 34 most useful Python packages — HTTP clients, data science, web frameworks, orchestration, testing, and tooling. Each has its own dedicated page with examples.
DSPy
Build LLM programs in DSPy with declarative signatures, modules, and optimisers. Covers Predict, ChainOfThought, ReAct, BootstrapFewShot, COPRO, MIPRO, MIPROv2, and inference compilation.
datetime
Work with dates, times, and timezones in Python using the stdlib datetime module and zoneinfo. Covers aware vs naive datetimes, ISO-8601 parsing, strftime/strptime, timedelta arithmetic, and DST handling.
dataclasses
Define typed data containers with @dataclass — frozen, slots, kw_only, default_factory, __post_init__, asdict, replace, and how it compares to attrs, pydantic, NamedTuple, TypedDict.
Claude API
Complete Python SDK reference for the Anthropic Claude API — messages, streaming, vision, extended thinking, prompt caching, batch processing, and token counting.
Claude API
The Anthropic Claude API — Python and TypeScript SDKs, streaming, tool use, batches, prompt caching, files, vision, and agentic loops.
BeautifulSoup
Parse, search, and mutate HTML/XML with BeautifulSoup 4. Covers parser choice (html.parser/lxml/html5lib), find/find_all/select, tree navigation, attribute access, and pairing with requests/httpx/playwright for end-to-end scraping.
argparse
Parse command-line arguments with Python's stdlib argparse module. Covers positional/optional args, subparsers, nargs, validation, mutually exclusive groups, FileType, env-var fallbacks, and argcomplete.
Sentence Transformers
Comprehensive reference for the sentence-transformers Python library — embeddings, similarity, clustering, retrieval, fine-tuning, and popular models (BGE, E5, GTE, Nomic, Jina).
Frameworks
Hugging Face Transformers, LangChain, Google Gemini SDK, and LangSmith — practical reference for AI/ML frameworks and observability tools.
weaviate-client
Store, search, and manage vector embeddings with the Weaviate Python client. Covers collections, CRUD, vector/hybrid/BM25 search, multi-tenancy, generative search, and batch import.
unstructured
Extract structured text from PDFs, Word docs, HTML, images, and more with the unstructured library. Covers partitioning, chunking, cleaning, metadata, and pipeline integrations.
typer
Build command-line interfaces using Python type annotations with Typer. Covers commands, options, arguments, subcommands, callbacks, rich output, and testing.
TruLens
Evaluate and monitor LLM applications with TruLens. Covers the RAG triad, feedback functions, TruChain, TruLlama, custom evaluators, the dashboard, and CI integration.
transformers
Load and run pre-trained models for NLP, vision, and audio with the Hugging Face Transformers library. Covers pipelines, AutoModel, tokenisation, generation, fine-tuning, and device placement.
tqdm
Add auto-updating progress bars to any Python loop or CLI pipeline with tqdm. Covers iterables, manual updates, pandas integration, nested bars, async, Jupyter, and byte-piping.
SQLModel
Define database models with Python type hints using SQLModel. Covers table creation, CRUD, relationships, FastAPI integration, Pydantic validation, and async sessions.
reflex
Build interactive web applications entirely in Python with Reflex. Covers state, components, events, pages, database, forms, and deployment.
ragas
Measure and improve RAG pipeline quality with ragas. Covers faithfulness, answer relevancy, context precision, context recall, dataset format, LLM judges, and CI integration.
qdrant-client
Store and search vector embeddings with the Qdrant Python client. Covers collections, CRUD, filtered vector search, payload indexing, batch upsert, sparse/dense hybrid search, and integrations.
prefect
Build, schedule, and observe Python workflows with Prefect. Covers flows, tasks, retries, schedules, deployments, caching, concurrency, and Prefect Cloud.
polars
High-performance DataFrames with a lazy expression API. Covers read/write, select, filter, group_by, joins, LazyFrame, datetime, string operations, and pandas interop.
notebooklm-py
Automate Google NotebookLM from Python with the unofficial notebooklm-py library. Covers authentication, notebook and source management, summaries, FAQ generation, and audio podcast creation.
modin
Speed up pandas workloads across all CPU cores with a one-line import swap. Covers Ray and Dask backends, config tuning, pandas interop, and when modin wins vs polars.
LlamaIndex
Build RAG pipelines and LLM-powered data applications with LlamaIndex. Covers document loading, indexing, query engines, custom LLMs and embeddings, persistent storage, and agents.
litestar
Build fast, type-safe HTTP APIs and web apps with Litestar. Covers route handlers, path/query/body params, DTOs, dependency injection, middleware, WebSockets, and OpenAPI.
LangSmith
Trace, debug, evaluate, and monitor LLM applications with LangSmith. Covers tracing setup, datasets, evaluators, prompt hub, comparing runs, and CI integration.
LangChain
Build LLM-powered pipelines with LangChain. Covers LCEL chains, chat models, prompts, output parsers, tools, agents, retrievers, memory, and streaming.
guidance
Interleave Python control flow with LLM generation and enforce structured output using guidance. Covers gen(), select(), chat blocks, regex constraints, JSON schemas, and token healing.
google-generativeai
Call Google's Gemini models from Python for text, multimodal, streaming, chat, function calling, and embeddings. Covers the genai SDK, safety settings, file API, and async usage.
DuckDB
Run fast analytical SQL queries in-process with DuckDB. Covers Python API, CSV/Parquet ingestion, pandas interop, Arrow, window functions, and persistent databases.
dagster
Build, schedule, and observe data pipelines as software-defined assets with Dagster. Covers assets, jobs, schedules, sensors, resources, partitions, and the Dagster UI.
crewAI
Orchestrate teams of role-playing AI agents with crewAI. Covers agents, tasks, crews, tools, LLM selection, memory, YAML config, and the kickoff lifecycle.
ChromaDB
Store and query vector embeddings locally or over a network with ChromaDB. Covers client types, collections, add, query, metadata filters, embedding functions, and LangChain/LlamaIndex integration.
AutoGen
Build multi-agent AI systems with Microsoft AutoGen. Covers agents, group chats, code execution, tool registration, async runtimes, and LLM configuration.
Programming
A reference hub for programming languages and their ecosystems — Python, JavaScript, and TypeScript, with package managers, runtimes, and tooling.
pip
Complete pip reference covering installation, package management, requirements files, private registries, caching, offline installs, and reproducible builds.
sqlalchemy
Connect to databases, write queries, and define ORM models with SQLAlchemy 2.0. Covers the engine, sessions, Core queries, ORM declarative models, relationships, session lifecycle, migrations with Alembic, and connection pool configuration.
scipy
Statistical distributions, optimization, integration, signal processing, and linear algebra with SciPy. Builds on NumPy arrays.
ruff
Lint and format Python code with ruff — a single Rust-powered tool that replaces flake8, isort, and black. Covers configuration, rule selection, and CI usage.
rich
Make terminal output beautiful with Rich. Covers styled print, Console, tables, progress bars, syntax highlighting, live displays, and the rich-cli command.
Python One-Liners
Useful Python one-liners runnable directly from the shell with python -c or python -m. No file creation needed.
Python CLI Snippets
Short standalone Python scripts for common tasks — file I/O, JSON manipulation, HTTP requests, CSV processing, and data transformation.
Python
Installation guides, essential packages, CLI snippets, and real-world recipes for Python 3.
pytest
Write and run Python tests with pytest. Covers test discovery, assertions, fixtures, parametrize, conftest, and common patterns.
Pillow
Open, resize, crop, convert, and save images with Pillow (PIL fork). Covers format conversion, filters, drawing, and EXIF handling.
pathlib
Work with filesystem paths using Python's built-in pathlib module. Covers Path creation, navigation, reading/writing files, glob patterns, and stat.
pandas
Load, filter, transform, and aggregate tabular data with pandas. Covers DataFrame creation, read_csv, groupby, merge, and the SettingWithCopy pitfall.
numpy
Create and manipulate N-dimensional arrays with NumPy. Covers array creation, broadcasting, vectorized math, indexing, and matrix operations.
mypy
Catch type errors before runtime with mypy. Covers strict mode, common error codes, type: ignore annotations, gradual typing, and pyproject.toml configuration.
matplotlib
Create publication-quality 2-D plots with matplotlib. Covers pyplot basics, subplots, savefig, common chart types, and the show-vs-save pitfall.
loguru
Add structured, colorized logging to Python apps with loguru. Covers sinks, log levels, file rotation, retention, exception catching, and context binding.
jupyter
Run interactive Python notebooks with Jupyter. Covers JupyterLab setup, cell types, keyboard shortcuts, magic commands, nbconvert export, and common pitfalls.
django
Build database-driven web applications with Django. Covers project setup, models, migrations, the admin panel, views, forms, class-based views, middleware, signals, ORM advanced patterns, and the management command workflow.
click
Build command-line interfaces with click using decorators. Covers commands, options, arguments, groups, prompts, and progress bars.
black
Format Python code consistently with black. Covers installation, configuration, editor integration, and how it compares to ruff format.
asyncio
Write concurrent Python code with asyncio. Covers coroutines, asyncio.run, gather, create_task, timeouts, queues, and avoiding the blocking-call pitfall.