A Python tool for enforcing and visualizing software architecture.
Project description
Architecture Governance & Architecture-as-Code
Warning: Experimental. Expect breaking changes until release 0.1.0
Pacta is an architecture governance tool that helps teams define architectural intent, gain insights through metrics and historical trends, detect architectural drift, and evolve codebases safely without blocking delivery.
pip install pacta
Supported languages:
- Python
- Java (coming soon)
- Go (coming soon)
- C# (coming soon)
Why?
Codebases rot. Architecture degrades through small changes no one tracks. Pacta turns architecture into something measurable, reviewable, and enforceable — catching drift early, not months later.
What it does
- Static analysis — parses Python AST, builds a system graph
- Layer enforcement — domain can't import from infra, etc.
- Snapshots — version your architecture like code
- Baseline mode — fail only on new violations, not legacy debt
- History tracking — view architecture evolution over time
- Trend analysis — track violations, nodes, edges over time with charts
Quick example
This is a minimal example. See the docs for advanced rules, baselines, and history.
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
History tracking
Every scan creates a content-addressed snapshot. Inspect how your architecture evolves over time:
# View timeline
$ pacta history show --last 5
# View trends over time (violations, nodes, edges, coupling)
$ pacta history trends .
Docs
Roadmap (short)
- Open-source CLI and analysis engine
- Content-addressed snapshots with history tracking
- Trend analysis with chart export
- Architecture visualization (Mermaid, D2)
- Health metrics (drift score, instability)
- Optional hosted service (future):
- Cross-repository insights
- Historical trend analysis
- Team-level governance and reporting
License
Apache-2.0. 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.3.tar.gz.
File metadata
- Download URL: pacta-0.0.3.tar.gz
- Upload date:
- Size: 724.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe9fc985e52c3925a05dba23d3734a33c31064bd8dd5e4526bcc0d4d21fcf387
|
|
| MD5 |
877c356a56f2b55587a051edefc3646f
|
|
| BLAKE2b-256 |
6a8c85a14c798129a2cd29059873ef638655fda3376f58ee1e6d68ca592f44c9
|
Provenance
The following attestation bundles were made for pacta-0.0.3.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.3.tar.gz -
Subject digest:
fe9fc985e52c3925a05dba23d3734a33c31064bd8dd5e4526bcc0d4d21fcf387 - Sigstore transparency entry: 854332567
- Sigstore integration time:
-
Permalink:
akhundMurad/pacta@0d6214b1fd0bcd3c32379fcf6296e9ab24a27493 -
Branch / Tag:
refs/tags/v0.0.3 - Owner: https://github.com/akhundMurad
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@0d6214b1fd0bcd3c32379fcf6296e9ab24a27493 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pacta-0.0.3-py3-none-any.whl.
File metadata
- Download URL: pacta-0.0.3-py3-none-any.whl
- Upload date:
- Size: 97.4 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 |
6cc45df6f9e77c66df7b7452fec6c9ed36b8a3b233d3a5d646998533f7de1687
|
|
| MD5 |
61ef866911ceac99578ddcff549bc025
|
|
| BLAKE2b-256 |
cc589aacac043115c41474b31763cfdcc926827d8723d9360d5b48871aaf0a96
|
Provenance
The following attestation bundles were made for pacta-0.0.3-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.3-py3-none-any.whl -
Subject digest:
6cc45df6f9e77c66df7b7452fec6c9ed36b8a3b233d3a5d646998533f7de1687 - Sigstore transparency entry: 854332569
- Sigstore integration time:
-
Permalink:
akhundMurad/pacta@0d6214b1fd0bcd3c32379fcf6296e9ab24a27493 -
Branch / Tag:
refs/tags/v0.0.3 - Owner: https://github.com/akhundMurad
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@0d6214b1fd0bcd3c32379fcf6296e9ab24a27493 -
Trigger Event:
push
-
Statement type: