Series Track

Python in Production: Architecture, Robustness, Async & FFI

A comprehensive track on modern, advanced Python development. Cover architecture, structural safety, structured async concurrency, and performance-critical Rust integrations.

← Back to all posts

01 Structural Integrity, Type Safety & Safe Design Patterns

Immutability and Defensive State Design in Python

python typing · by Adrian Benavides · August 6, 2026 · 8 min read

Frozen dataclasses are the default for domain value objects, but they don't validate at runtime. msgspec.Struct closes that gap with a single type that decodes, validates, and stays immutable across the wire boundary and the domain layer. attrs and cattrs cover the same ground in two libraries, and pydantic only earns its place when the ecosystem integration matters.

02 Defining Boundaries

Cross-Cutting Concerns Without Constructor Over-Injection

python architecture · by Adrian Benavides · August 3, 2026 · 5 min read

Use contextvars.ContextVar for cross-cutting concerns that almost every service needs, without threading them through every constructor. Covers per-task isolation, structlog and opentelemetry designs, sync-vs-async leaks, and the failure modes that show up in production.