StackPractices

Tag: python

Browse 163 practical software engineering resources tagged with "python". Discover code recipes, design patterns, documentation templates, and in-depth guides to help you build, deploy, and maintain production-ready solutions involving python. Each resource is written for engineers who ship real systems, with copy-paste examples and practical trade-offs.

Python for Production Engineering

Python powers a huge share of backend services, data pipelines, automation scripts, and machine learning workloads. Writing production-grade Python means going beyond syntax: you need type hints, robust error handling, dependency management, packaging, testing, and observability that match the expectations of a running service.

The resources in this collection cover practical recipes for API development, data processing, concurrency, testing, security, and deployment. Each example focuses on code you can run, adapt, and ship with confidence.

Every resource includes clear explanations, copy-paste code, and practical warnings. Use them to make informed decisions, avoid production pitfalls, and speed up your delivery. If you are just getting started, read the beginner-friendly articles first; if you are experienced, jump straight to the advanced patterns and architecture guides. New resources are added regularly, so bookmark this page and check back for the latest patterns.

Build Stateful AI Agents with LangGraph State Machines

Create multi-step AI agents with LangGraph using state machines, conditional edges, tool calling,...

Fine-Tune and Deploy Text Classifiers with Hugging Face

Fine-tune a pre-trained transformer model for text classification using Hugging Face Trainer,...

Compose LCEL Chains in LangChain for Multi-Step LLM

Build composable LLM pipelines with LangChain Expression Language (LCEL) using pipes, parallel...

Evaluate RAG Quality with RAGAS Metrics

Measure RAG pipeline quality using RAGAS framework metrics — faithfulness, answer relevancy,...

Stream LLM Output with Server-Sent Events (SSE)

Stream LLM responses to clients in real-time using Server-Sent Events with FastAPI, OpenAI...

Run LLMs Locally with Ollama for Private Inference

Install and use Ollama to run open-source LLMs locally with Python, including streaming,...

Compare Text Semantic Similarity with OpenAI Embeddings

Generate text embeddings with OpenAI and compute cosine similarity to measure semantic similarity...

Structured JSON Output from OpenAI Function Calling

Use OpenAI function calling and structured outputs to get reliable JSON from LLMs with Pydantic...

a Local RAG Pipeline with ChromaDB and Sentence Transformers

Implement retrieval-augmented generation locally with ChromaDB, sentence-transformers embeddings,...

Sentiment Analysis with Python and NLTK

Score text sentiment using NLTK VADER and custom lexicons in Python. Classify reviews, process...

Store and Query Embeddings in Pinecone Vector Database

Use Pinecone to store, query, and filter vector embeddings for semantic search with metadata...

Build Semantic Search with Embeddings in Python, JS, Java

Build a semantic search engine with text embeddings and vector similarity. Includes Python,...

Handle API Errors with RFC 7807 and HTTP Status Codes

Patterns for consistent, predictable API error handling across multiple languages and frameworks.

Python API Rate Limiting with Token Bucket

Implement token bucket rate limiting in Flask and FastAPI with Redis support

Send Transactional Emails with SMTP in Python, Node.js, Java

Learn to send transactional and bulk emails via SMTP with Python, Node.js, and Java. Covers auth,...

Dependency Injection

Implement dependency injection to write testable, decoupled code across languages and frameworks.

How to Hash Passwords Securely (Python, JavaScript, Java)

Learn how to hash and verify passwords with bcrypt, Argon2, and PBKDF2. Practical examples in...

Cache Database Query Results with Redis and Python

Cache expensive database query results in Redis with cache-aside pattern, TTL management, and...

Cache Database Queries with Django Cache Framework

Use Django's built-in cache framework with per-view caching, template fragment caching, and...

Cache HTTP Responses with httpx and CacheControl in Python

Cache HTTP responses in Python using httpx with CacheControl for HTTP-compliant caching, ETag...