Analysis updated 2026-05-18
Codify rules like 'API must not import database internals' and enforce them in CI.
Detect and block circular import dependencies before they merge.
Gradually adopt architecture rules on an existing codebase using date-scoped rules.
Run architecture checks alongside pytest unit tests.
| mossabarektout/archetype-py | 0marildo/imago | agentlexi/agent-lexi | |
|---|---|---|---|
| Stars | 3 | 3 | 3 |
| Language | Python | Python | Python |
| Setup difficulty | easy | easy | moderate |
| Complexity | 3/5 | 2/5 | 4/5 |
| Audience | developer | general | vibe coder |
Figures from each repo's GitHub metadata at analysis time.
Requires Python 3.11 or newer, install via pip.
archetype-py is a Python library that lets software teams write their architectural rules as code and automatically check that those rules are never broken as the codebase grows. Architecture here means the structural decisions about how different parts of a program are allowed to talk to each other, for example, the API layer must not directly call the database layer, or no two modules may depend on each other in a circle. Without a tool like this, these rules live only in documentation or team memory and silently erode over time. With archetype-py, you create a file called architecture.py in your project and write Python functions decorated with rule to describe what is and is not allowed. The command line tool then inspects your codebase's actual import relationships and flags violations with a clear message showing exactly which file broke which rule. Rules can be set to fail the build or only warn, and some can be scoped to files changed after a specific date, helping teams adopt the tool gradually on existing codebases. The checks integrate with pytest, a popular Python testing framework, so architecture tests run alongside unit tests, and a single line in a CI pipeline is enough to enforce rules on every pull request. A skip decorator lets teams temporarily defer a rule, and a group system lets you run subsets of rules independently. It is aimed at Python projects following patterns like Clean Architecture, Hexagonal Architecture, or Domain driven design, especially growing teams where tribal knowledge about module boundaries is no longer reliable. The tool is installed with pip, requires Python 3.11 or newer, and is released under the MIT license. The full README is longer than what was shown.
A Python tool that lets teams write architecture rules as code and automatically enforce them in tests and CI.
Mainly Python. The stack also includes Python, pytest.
Use freely for any purpose, including commercial use, as long as you keep the copyright notice.
Setup difficulty is rated easy, with roughly 30min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.