The cookbook provides ready-to-use recipes for common structure and symbol-placement scenarios. Each recipe shows a complete configuration, a violation example, and a passing example so you can adapt it to your project immediately.
Every recipe is drawn from one hexagonal-architecture project — the same src/contexts/{ctx} tree with domain, application, and adapters layers, mirrored by a tests tree — so the configs compose into a single .python-structure-linter.yaml.
Recipes¶
| Recipe | Description |
|---|---|
| Context Layers | Require every context to contain domain, application, and adapters layer directories |
| Component Directories | Restrict a layer to recognized component directories, allowing optional subdomain grouping tiers |
| Tests Mirror Source | Require every directory in the tests tree to have a counterpart in the src tree |
| One Class Per Module | Limit each domain module to a single top-level class definition |
| One Error Per File | Require each errors module to define exactly one error class |
| Public API Surface | Constrain a module's public symbol count while leaving private helpers unrestricted |