ArchUnitPython icon indicating copy to clipboard operation
ArchUnitPython copied to clipboard

[FEATURE] Clean Architecture 'Dependency Rule' preset

Open LukasNiessen opened this issue 4 months ago • 0 comments

In short

A one-line preset for classic Clean Architecture layering: inner business logic must not depend on outer layers (web framework, database). Fails if, say, an entity imports a web controller.

Problem

The single most-requested architecture rule: source dependencies may only point inward, boundaries crossed only via interfaces. Expressible with project_layers(...) today, but a canonical preset makes it a one-liner.

Proposal

A named preset over the existing project_layers(...) API that wires the concentric inward-only direction, e.g. clean_architecture("src/").entities("**/domain/**").use_cases("**/application/**").adapters("**/infrastructure/**"), plus the dependency-inversion corollary.

Acceptance criteria

  • [ ] An inner ring importing an outer ring fails with the offending edge.
  • [ ] Documented as a copy-paste recipe in the README.

LukasNiessen avatar Jul 26 '26 22:07 LukasNiessen