Architecture Checker
Architecture Checker is a standalone Python tool for enforcing architectural patterns and dependencies in large python projects. By analyzing code structure and dependencies, this tool ensures that architectural rules are followed, promoting cleaner, more maintainable, and modular codebases.
Inspired by https://github.com/qossmic/deptrac
Features
- Layer-Based Analysis: Define project layers and restrict their dependencies to enforce modularity.
- Dynamic Layer Configuration: Easily configure collectors for each layer using file patterns and class inheritance.
- Cross-Layer Dependency Rules (TODO): Specify rules to disallow certain layers from accessing others.
- Extensible and Configurable: Customize layers and rules for any python project setup.
Installation
To install Architecture Checker, use pip:
pip install architecture_checker
Configuration
Before running the tool, create a configuration file (config.yaml or similar) that specifies the rules and target
files to enforce.
Example Configuration (config.example.yaml)
layers:
- name: models
collectors:
- type: class_inherits
base_class: "django.db.models.Model"
- name: services
collectors:
- type: file_regex
regex: "^.*/providers.py$"
- name: views
collectors:
- type: file_regex
regex: ".*/views_api.py"
ruleset:
views:
disallow:
- models # Disallows direct access to models in views
Usage
Run the tool from the command line by specifying the project root directory and configuration file:
python run_architecture_checker.py --project_root='/path/to/your_project' --config=config.example.yaml
Arguments
--project_root: The path to the root of the project where apps are located.--config: Path to the configuration file that defines the rules and target files.
Sample Output
If violations are found, the tool will output a summary of architectural violations grouped by app, along with details of each violation, such as the file, line number, and violation message.
/path/to/your_project/your_project/app1/views_api.py:74 - Layer 'views' is not allowed to depend on layer 'models'
Running Tests
To test the tool, use unittest:
python -m unittest discover tests
License
See the LICENSE file for details.
Metadata
Release files for architecture-checker 0.2.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| architecture_checker-0.2.9.tar.gz | 9.5 kB | Without provenance | Details for architecture_checker-0.2.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| architecture_checker-0.2.9-py3-none-any.whl | Python 3 | none | any | Details for architecture_checker-0.2.9-py3-none-any.whl |
Total release size: 22.1 kB
Release files / architecture_checker-0.2.9.tar.gz
| Download URL | architecture_checker-0.2.9.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
43ddd120b53609fa501942c7d9a93defa294d18e44a1e26ca51e14aabd4d52a1
|
|
BLAKE2b-256 checksum How to use checksums |
927b9eac887381a9ed5fcf23c6def8e8d4da8c7cb03f2876f26a552a956d747b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Release files / architecture_checker-0.2.9-py3-none-any.whl
| Download URL | architecture_checker-0.2.9-py3-none-any.whl |
|---|---|
| Size | 12.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4dbaa2e8f93a1dee36109c1acc82957e594425a04427eeb8b9f9e970fa1d818b
|
|
BLAKE2b-256 checksum How to use checksums |
4ff46391eb84e5cc152b8515f604fed9443db70912a596b9243dee21509ff069
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Security for architecture-checker 0.2.9
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.