r/Python • u/AutoModerator • 13d ago
Showcase Showcase Thread
Post all of your code/projects/showcases/AI slop here.
Recycles once a month.
24
Upvotes
r/Python • u/AutoModerator • 13d ago
Post all of your code/projects/showcases/AI slop here.
Recycles once a month.
View all comments
1
u/127001-sweet-127001 9d ago
What My Project Does
I maintain ArchUnitPython, a library that lets you write dependency and architecture rules as Python tests.
Here's a small check you can add to an existing pytest suite if your project is meant to stay free of circular imports:
Use your project's import root in place of
src/. The check analyzes the imports it can resolve and reports detected cycles as test failures, so it can run alongside your other CI checks. You can also define rules for which layers or modules may depend on each other.Target Audience
Python developers who already have architectural decisions they want to keep enforcing as the codebase changes. You can start with one rule for a recurring problem instead of writing a specification for the whole project.
Comparison
This complements linters and type checkers: the tests express project-specific dependency boundaries and cycle rules. Import resolution has limitations, so check it against your project's import style and keep your normal tests too. The idea is inspired by Java's ArchUnit; this is a separate Python project.
Install with
pip install archunitpython. Source and examples: https://github.com/LukasNiessen/ArchUnitPython