Sam Keen of Altered Craft (AI Architect | ex-AWS, Lululemon, Nike) and author of Clean Architecture with Python (Packt, 2025)—joins The Deep Engineering Podcast to unpack what “clean architecture” means in a dynamic, Python-first world. We dig into how to adapt DDD and SOLID to real Python codebases, enforce the dependency rule so frameworks stay at the edge, and model entities/value objects with dataclasses and Pydantic without turning Python into Java. Sam also shares hard-won lessons from refactoring legacy systems and how to use generative AI to accelerate development while preserving architectural intent.
What you’ll learn
How to explain and apply clean architecture in Pythonic terms—layers, boundaries, and ADRs without over-engineering
Practical ways to enforce the dependency rule in Python using directory layout, import discipline, and fitness-function tests
Modeling entities and value objects with dataclasses, when it’s acceptable to let Pydantic into the domain, and how to document that compromise
Building a real test pyramid: fast, pure domain unit tests; integration tests across layers; and focused end-to-end coverage
Incremental strategies for refactoring legacy Python systems (strangler-fig, bounded contexts, gateways) instead of Big Bang rewrites
How AI coding tools and LLM-based services fit into clean architecture—as outer-layer drivers guided by clear domain boundaries
Who should listen: Python tech leads, staff/principal engineers, backend and platform teams, software architects, and anyone responsible for keeping growing Python systems maintainable while introducing AI and new frameworks safely.







