A Python tool for enforcing and visualizing software architecture.
Project description
Architecture Testing & Architecture-as-Code
Warning: Experimental. Expect breaking changes.
Pacta enforces architectural rules in your codebase. Define layers, set boundaries, catch violations in CI.
Supported languages:
- Python
- Java (coming soon)
- Go (coming soon)
- C# (coming soon)
pip install pacta
pacta scan . --model architecture.yml --rules rules.pacta.yml
Why?
Codebases rot. The "clean architecture" you designed becomes spaghetti after a few quarters. Pacta catches violations early — in PRs, not post-mortems.
What it does
- Static analysis — parses Python AST, builds import graph
- Layer enforcement — domain can't import from infra, etc.
- Baseline mode — fail only on new violations, not legacy debt
- Snapshots — version your architecture like code
Quick example
Define your layers in architecture.yml:
version: 1
system:
id: myapp
name: My App
containers:
backend:
code:
roots: [src]
layers:
domain:
patterns: [src/domain/**]
infra:
patterns: [src/infra/**]
Add rules in rules.pacta.yml:
rule:
id: no_domain_to_infra
name: Domain cannot depend on Infrastructure
severity: error
target: dependency
when:
all:
- from.layer == domain
- to.layer == infra
action: forbid
message: Domain layer must not import from Infrastructure
Run it:
$ pacta scan . --model architecture.yml --rules rules.pacta.yml
✗ 2 violations (2 error) [2 new]
✗ ERROR [no_domain_to_infra] Domain cannot depend on Infrastructure @ src/domain/user.py:3:1
status: new
Domain layer must not import from Infrastructure
Baseline workflow
Got legacy violations? Save a baseline and only fail on new ones:
# Save current state
pacta scan . --model architecture.yml --rules rules.pacta.yml --save-ref baseline
# Later, in CI — fail only on new violations
pacta scan . --model architecture.yml --rules rules.pacta.yml --baseline baseline
Docs
License
AGPL-3.0-only. See LICENSE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pacta-0.0.1.tar.gz.
File metadata
- Download URL: pacta-0.0.1.tar.gz
- Upload date:
- Size: 179.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12fb8d1787c0b4bf81868e6634ea4a964e7339f2c690215d75922c1f4c894d67
|
|
| MD5 |
df2f5ad2f1eaf757e9b8c34b7ed1c50a
|
|
| BLAKE2b-256 |
a96ab8dac56758264de684910de594d8e00f9a7e4b133f7e57462fec00e0d868
|
Provenance
The following attestation bundles were made for pacta-0.0.1.tar.gz:
Publisher:
publish.yaml on akhundMurad/pacta
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pacta-0.0.1.tar.gz -
Subject digest:
12fb8d1787c0b4bf81868e6634ea4a964e7339f2c690215d75922c1f4c894d67 - Sigstore transparency entry: 846826861
- Sigstore integration time:
-
Permalink:
akhundMurad/pacta@0ebe74e3ae4a2bc939b255fb790080e78ecacb2f -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/akhundMurad
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@0ebe74e3ae4a2bc939b255fb790080e78ecacb2f -
Trigger Event:
push
-
Statement type:
File details
Details for the file pacta-0.0.1-py3-none-any.whl.
File metadata
- Download URL: pacta-0.0.1-py3-none-any.whl
- Upload date:
- Size: 113.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
820ce5100afefd87fbca923186a0378718bdf46c50979bd9726df54b58b23111
|
|
| MD5 |
3395053e01af0456d9c5c2da127f3204
|
|
| BLAKE2b-256 |
508caf5d4312f7c75376b033a1e4937e1026d9db21b90e71ab3346c38e1526e4
|
Provenance
The following attestation bundles were made for pacta-0.0.1-py3-none-any.whl:
Publisher:
publish.yaml on akhundMurad/pacta
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pacta-0.0.1-py3-none-any.whl -
Subject digest:
820ce5100afefd87fbca923186a0378718bdf46c50979bd9726df54b58b23111 - Sigstore transparency entry: 846826897
- Sigstore integration time:
-
Permalink:
akhundMurad/pacta@0ebe74e3ae4a2bc939b255fb790080e78ecacb2f -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/akhundMurad
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@0ebe74e3ae4a2bc939b255fb790080e78ecacb2f -
Trigger Event:
push
-
Statement type: