buttress 0.2.0a1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- buttress-0.2.0a1/LICENSE +21 -0
- buttress-0.2.0a1/PKG-INFO +264 -0
- buttress-0.2.0a1/README.md +219 -0
- buttress-0.2.0a1/pyproject.toml +115 -0
- buttress-0.2.0a1/setup.cfg +4 -0
- buttress-0.2.0a1/src/buttress/__init__.py +63 -0
- buttress-0.2.0a1/src/buttress/__main__.py +7 -0
- buttress-0.2.0a1/src/buttress/analysis/__init__.py +44 -0
- buttress-0.2.0a1/src/buttress/analysis/discovery.py +176 -0
- buttress-0.2.0a1/src/buttress/analysis/external.py +92 -0
- buttress-0.2.0a1/src/buttress/analysis/extractor.py +329 -0
- buttress-0.2.0a1/src/buttress/analysis/interfaces.py +49 -0
- buttress-0.2.0a1/src/buttress/analysis/manifest_parser.py +337 -0
- buttress-0.2.0a1/src/buttress/analysis/resolver.py +143 -0
- buttress-0.2.0a1/src/buttress/analysis/scanner.py +179 -0
- buttress-0.2.0a1/src/buttress/analysis/stdlib.py +60 -0
- buttress-0.2.0a1/src/buttress/api/__init__.py +129 -0
- buttress-0.2.0a1/src/buttress/api/analysis.py +51 -0
- buttress-0.2.0a1/src/buttress/api/baselines.py +29 -0
- buttress-0.2.0a1/src/buttress/api/contracts.py +85 -0
- buttress-0.2.0a1/src/buttress/api/project.py +881 -0
- buttress-0.2.0a1/src/buttress/api/synchronization.py +40 -0
- buttress-0.2.0a1/src/buttress/application/__init__.py +24 -0
- buttress-0.2.0a1/src/buttress/application/analysis_service.py +209 -0
- buttress-0.2.0a1/src/buttress/application/baseline_service.py +62 -0
- buttress-0.2.0a1/src/buttress/application/context.py +45 -0
- buttress-0.2.0a1/src/buttress/application/contract_service.py +236 -0
- buttress-0.2.0a1/src/buttress/application/report_service.py +164 -0
- buttress-0.2.0a1/src/buttress/application/sync_service.py +100 -0
- buttress-0.2.0a1/src/buttress/application/test_impact_service.py +219 -0
- buttress-0.2.0a1/src/buttress/cli/__init__.py +6 -0
- buttress-0.2.0a1/src/buttress/cli/commands/__init__.py +2 -0
- buttress-0.2.0a1/src/buttress/cli/commands/architecture_cmd.py +231 -0
- buttress-0.2.0a1/src/buttress/cli/commands/baseline_cmd.py +157 -0
- buttress-0.2.0a1/src/buttress/cli/commands/cache_cmd.py +120 -0
- buttress-0.2.0a1/src/buttress/cli/commands/check_cmd.py +232 -0
- buttress-0.2.0a1/src/buttress/cli/commands/check_external_cmd.py +197 -0
- buttress-0.2.0a1/src/buttress/cli/commands/config_cmd.py +153 -0
- buttress-0.2.0a1/src/buttress/cli/commands/configure_cmd.py +297 -0
- buttress-0.2.0a1/src/buttress/cli/commands/contracts_cmd.py +205 -0
- buttress-0.2.0a1/src/buttress/cli/commands/deadcode_cmd.py +166 -0
- buttress-0.2.0a1/src/buttress/cli/commands/doctor_cmd.py +105 -0
- buttress-0.2.0a1/src/buttress/cli/commands/explain_cmd.py +116 -0
- buttress-0.2.0a1/src/buttress/cli/commands/fix_cmd.py +320 -0
- buttress-0.2.0a1/src/buttress/cli/commands/graph_cmd.py +64 -0
- buttress-0.2.0a1/src/buttress/cli/commands/init_cmd.py +143 -0
- buttress-0.2.0a1/src/buttress/cli/commands/install_cmd.py +42 -0
- buttress-0.2.0a1/src/buttress/cli/commands/map_cmd.py +67 -0
- buttress-0.2.0a1/src/buttress/cli/commands/mod_cmd.py +266 -0
- buttress-0.2.0a1/src/buttress/cli/commands/report_cmd.py +148 -0
- buttress-0.2.0a1/src/buttress/cli/commands/scan_cmd.py +183 -0
- buttress-0.2.0a1/src/buttress/cli/commands/show_cmd.py +65 -0
- buttress-0.2.0a1/src/buttress/cli/commands/sync_cmd.py +200 -0
- buttress-0.2.0a1/src/buttress/cli/commands/test_cmd.py +130 -0
- buttress-0.2.0a1/src/buttress/cli/entrypoint.py +316 -0
- buttress-0.2.0a1/src/buttress/cli/formatters/__init__.py +2 -0
- buttress-0.2.0a1/src/buttress/cli/formatters/console.py +64 -0
- buttress-0.2.0a1/src/buttress/configuration/__init__.py +67 -0
- buttress-0.2.0a1/src/buttress/configuration/discovery.py +158 -0
- buttress-0.2.0a1/src/buttress/configuration/domain.py +153 -0
- buttress-0.2.0a1/src/buttress/configuration/loader.py +225 -0
- buttress-0.2.0a1/src/buttress/configuration/migration.py +159 -0
- buttress-0.2.0a1/src/buttress/configuration/models.py +361 -0
- buttress-0.2.0a1/src/buttress/configuration/precedence.py +93 -0
- buttress-0.2.0a1/src/buttress/configuration/schema.py +25 -0
- buttress-0.2.0a1/src/buttress/configuration/validator.py +263 -0
- buttress-0.2.0a1/src/buttress/configuration/writer.py +236 -0
- buttress-0.2.0a1/src/buttress/contracts/__init__.py +41 -0
- buttress-0.2.0a1/src/buttress/contracts/acyclic_siblings.py +187 -0
- buttress-0.2.0a1/src/buttress/contracts/analyzer.py +225 -0
- buttress-0.2.0a1/src/buttress/contracts/base.py +236 -0
- buttress-0.2.0a1/src/buttress/contracts/declarative.py +701 -0
- buttress-0.2.0a1/src/buttress/contracts/forbidden.py +155 -0
- buttress-0.2.0a1/src/buttress/contracts/independence.py +126 -0
- buttress-0.2.0a1/src/buttress/contracts/layers.py +505 -0
- buttress-0.2.0a1/src/buttress/contracts/module_policy.py +313 -0
- buttress-0.2.0a1/src/buttress/contracts/protected.py +126 -0
- buttress-0.2.0a1/src/buttress/contracts/public_interface.py +128 -0
- buttress-0.2.0a1/src/buttress/contracts/registry.py +452 -0
- buttress-0.2.0a1/src/buttress/domain/__init__.py +137 -0
- buttress-0.2.0a1/src/buttress/domain/baseline.py +146 -0
- buttress-0.2.0a1/src/buttress/domain/contract.py +122 -0
- buttress-0.2.0a1/src/buttress/domain/exceptions.py +637 -0
- buttress-0.2.0a1/src/buttress/domain/finding.py +118 -0
- buttress-0.2.0a1/src/buttress/domain/graph.py +607 -0
- buttress-0.2.0a1/src/buttress/domain/import_statement.py +67 -0
- buttress-0.2.0a1/src/buttress/domain/module.py +230 -0
- buttress-0.2.0a1/src/buttress/domain/policy.py +131 -0
- buttress-0.2.0a1/src/buttress/domain/suppression.py +128 -0
- buttress-0.2.0a1/src/buttress/infrastructure/cache/__init__.py +12 -0
- buttress-0.2.0a1/src/buttress/infrastructure/cache/manager.py +146 -0
- buttress-0.2.0a1/src/buttress/infrastructure/cache/models.py +99 -0
- buttress-0.2.0a1/src/buttress/infrastructure/cache/sqlite_store.py +340 -0
- buttress-0.2.0a1/src/buttress/infrastructure/exporters/__init__.py +18 -0
- buttress-0.2.0a1/src/buttress/infrastructure/exporters/dot.py +49 -0
- buttress-0.2.0a1/src/buttress/infrastructure/exporters/json_export.py +39 -0
- buttress-0.2.0a1/src/buttress/infrastructure/exporters/mermaid.py +49 -0
- buttress-0.2.0a1/src/buttress/infrastructure/exporters/sarif.py +115 -0
- buttress-0.2.0a1/src/buttress/infrastructure/grimp_adapter.py +80 -0
- buttress-0.2.0a1/src/buttress/infrastructure/vcs/__init__.py +6 -0
- buttress-0.2.0a1/src/buttress/infrastructure/vcs/git_adapter.py +115 -0
- buttress-0.2.0a1/src/buttress/integrations/__init__.py +20 -0
- buttress-0.2.0a1/src/buttress/integrations/github_actions.py +74 -0
- buttress-0.2.0a1/src/buttress/integrations/pre_commit.py +91 -0
- buttress-0.2.0a1/src/buttress/integrations/pytest_plugin.py +74 -0
- buttress-0.2.0a1/src/buttress/plugins/__init__.py +13 -0
- buttress-0.2.0a1/src/buttress/plugins/loader.py +339 -0
- buttress-0.2.0a1/src/buttress/plugins/manager.py +136 -0
- buttress-0.2.0a1/src/buttress/py.typed +1 -0
- buttress-0.2.0a1/src/buttress/remediation/__init__.py +32 -0
- buttress-0.2.0a1/src/buttress/remediation/conflicts.py +113 -0
- buttress-0.2.0a1/src/buttress/remediation/diff.py +63 -0
- buttress-0.2.0a1/src/buttress/remediation/models.py +307 -0
- buttress-0.2.0a1/src/buttress/remediation/rules/__init__.py +7 -0
- buttress-0.2.0a1/src/buttress/remediation/rules/ast_utils.py +214 -0
- buttress-0.2.0a1/src/buttress/remediation/rules/base.py +58 -0
- buttress-0.2.0a1/src/buttress/remediation/rules/builtin/__init__.py +23 -0
- buttress-0.2.0a1/src/buttress/remediation/rules/builtin/lazy_import_wrapper.py +378 -0
- buttress-0.2.0a1/src/buttress/remediation/rules/builtin/module_policy_deprecation.py +129 -0
- buttress-0.2.0a1/src/buttress/remediation/rules/builtin/remove_stale_ignore_comment.py +100 -0
- buttress-0.2.0a1/src/buttress/remediation/rules/builtin/remove_unused_forbidden_import.py +159 -0
- buttress-0.2.0a1/src/buttress/remediation/rules/builtin/replace_with_public_facade.py +173 -0
- buttress-0.2.0a1/src/buttress/remediation/rules/builtin/type_checking_guard.py +192 -0
- buttress-0.2.0a1/src/buttress/remediation/rules/custom.py +210 -0
- buttress-0.2.0a1/src/buttress/remediation/rules/registry.py +100 -0
- buttress-0.2.0a1/src/buttress/remediation/service.py +259 -0
- buttress-0.2.0a1/src/buttress/remediation/transaction.py +348 -0
- buttress-0.2.0a1/src/buttress/remediation/transformer.py +983 -0
- buttress-0.2.0a1/src/buttress/remediation/verifier.py +118 -0
- buttress-0.2.0a1/src/buttress/server/__init__.py +11 -0
- buttress-0.2.0a1/src/buttress/server/api/__init__.py +6 -0
- buttress-0.2.0a1/src/buttress/server/api/handlers.py +879 -0
- buttress-0.2.0a1/src/buttress/server/api/metadata.py +395 -0
- buttress-0.2.0a1/src/buttress/server/router.py +186 -0
- buttress-0.2.0a1/src/buttress/server/security.py +91 -0
- buttress-0.2.0a1/src/buttress/server/server.py +304 -0
- buttress-0.2.0a1/src/buttress/server/static/css/components.css +862 -0
- buttress-0.2.0a1/src/buttress/server/static/css/diff.css +119 -0
- buttress-0.2.0a1/src/buttress/server/static/css/graph.css +256 -0
- buttress-0.2.0a1/src/buttress/server/static/css/layout.css +570 -0
- buttress-0.2.0a1/src/buttress/server/static/css/reset.css +76 -0
- buttress-0.2.0a1/src/buttress/server/static/css/tokens.css +67 -0
- buttress-0.2.0a1/src/buttress/server/static/img/logo.png +0 -0
- buttress-0.2.0a1/src/buttress/server/static/index.html +191 -0
- buttress-0.2.0a1/src/buttress/server/static/js/app.js +345 -0
- buttress-0.2.0a1/src/buttress/server/static/js/components/diff_viewer.js +100 -0
- buttress-0.2.0a1/src/buttress/server/static/js/core/api.js +119 -0
- buttress-0.2.0a1/src/buttress/server/static/js/core/dom.js +152 -0
- buttress-0.2.0a1/src/buttress/server/static/js/core/state.js +103 -0
- buttress-0.2.0a1/src/buttress/server/static/js/graph/canvas.js +189 -0
- buttress-0.2.0a1/src/buttress/server/static/js/graph/layout.js +224 -0
- buttress-0.2.0a1/src/buttress/server/static/js/graph/renderer.js +76 -0
- buttress-0.2.0a1/src/buttress/server/static/js/graph/table_fallback.js +65 -0
- buttress-0.2.0a1/src/buttress/server/static/js/icons.js +29 -0
- buttress-0.2.0a1/src/buttress/server/static/js/views/about_panel.js +73 -0
- buttress-0.2.0a1/src/buttress/server/static/js/views/architecture.js +240 -0
- buttress-0.2.0a1/src/buttress/server/static/js/views/baselines.js +226 -0
- buttress-0.2.0a1/src/buttress/server/static/js/views/contracts.js +643 -0
- buttress-0.2.0a1/src/buttress/server/static/js/views/dependencies.js +324 -0
- buttress-0.2.0a1/src/buttress/server/static/js/views/help_panel.js +397 -0
- buttress-0.2.0a1/src/buttress/server/static/js/views/impact.js +149 -0
- buttress-0.2.0a1/src/buttress/server/static/js/views/inspector.js +213 -0
- buttress-0.2.0a1/src/buttress/server/static/js/views/overview.js +344 -0
- buttress-0.2.0a1/src/buttress/server/static/js/views/remediation.js +398 -0
- buttress-0.2.0a1/src/buttress/server/static/js/views/reports.js +113 -0
- buttress-0.2.0a1/src/buttress/server/static/js/views/settings.js +511 -0
- buttress-0.2.0a1/src/buttress/server/static/js/views/violations.js +278 -0
- buttress-0.2.0a1/src/buttress/utils/__init__.py +2 -0
- buttress-0.2.0a1/src/buttress/utils/atomic_write.py +262 -0
- buttress-0.2.0a1/src/buttress/utils/path_utils.py +120 -0
- buttress-0.2.0a1/src/buttress/version.py +5 -0
- buttress-0.2.0a1/src/buttress.egg-info/PKG-INFO +264 -0
- buttress-0.2.0a1/src/buttress.egg-info/SOURCES.txt +175 -0
- buttress-0.2.0a1/src/buttress.egg-info/dependency_links.txt +1 -0
- buttress-0.2.0a1/src/buttress.egg-info/entry_points.txt +5 -0
- buttress-0.2.0a1/src/buttress.egg-info/requires.txt +27 -0
- buttress-0.2.0a1/src/buttress.egg-info/top_level.txt +1 -0
buttress-0.2.0a1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Viraj Ravani
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: buttress
|
|
3
|
+
Version: 0.2.0a1
|
|
4
|
+
Summary: Enterprise-grade Python architecture analysis and enforcement
|
|
5
|
+
Author-email: viraj ravani <ravaniviraj@gmail.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Keywords: architecture,dependency-analysis,import-linter,tach,static-analysis,layer-architecture,linter
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
18
|
+
Classifier: Topic :: Software Development :: Testing
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: click>=8.1.0
|
|
23
|
+
Requires-Dist: rich>=13.0.0
|
|
24
|
+
Requires-Dist: pydantic>=2.5.0
|
|
25
|
+
Requires-Dist: grimp>=3.2.0
|
|
26
|
+
Requires-Dist: libcst>=1.1.0
|
|
27
|
+
Requires-Dist: tomli-w>=1.0.0
|
|
28
|
+
Requires-Dist: tomli>=2.0.0; python_version < "3.11"
|
|
29
|
+
Requires-Dist: pathspec>=0.11.0
|
|
30
|
+
Requires-Dist: packaging>=21.0
|
|
31
|
+
Provides-Extra: test
|
|
32
|
+
Requires-Dist: pytest>=7.0.0; extra == "test"
|
|
33
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "test"
|
|
34
|
+
Requires-Dist: networkx>=3.0; extra == "test"
|
|
35
|
+
Provides-Extra: e2e
|
|
36
|
+
Requires-Dist: playwright>=1.40.0; extra == "e2e"
|
|
37
|
+
Provides-Extra: dev
|
|
38
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
39
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
40
|
+
Requires-Dist: networkx>=3.0; extra == "dev"
|
|
41
|
+
Requires-Dist: playwright>=1.40.0; extra == "dev"
|
|
42
|
+
Requires-Dist: ruff; extra == "dev"
|
|
43
|
+
Requires-Dist: mypy; extra == "dev"
|
|
44
|
+
Dynamic: license-file
|
|
45
|
+
|
|
46
|
+
<p align="center">
|
|
47
|
+
<img src="docs/assets/buttress-logo.png" alt="Buttress Logo" width="132" />
|
|
48
|
+
</p>
|
|
49
|
+
|
|
50
|
+
<h1 align="center">Buttress</h1>
|
|
51
|
+
|
|
52
|
+
<p align="center">
|
|
53
|
+
<strong>Offline-first Python architecture governance, dependency graph analysis, and LibCST auto-remediation.</strong>
|
|
54
|
+
</p>
|
|
55
|
+
|
|
56
|
+
<p align="center">
|
|
57
|
+
<a href="https://pypi.org/project/buttress/"><img src="https://img.shields.io/pypi/v/buttress?color=18181b&style=flat-square" alt="PyPI" /></a>
|
|
58
|
+
<img src="https://img.shields.io/badge/python-%3E%3D3.10-18181b?style=flat-square&logo=python&logoColor=white" alt="Python >=3.10" />
|
|
59
|
+
<img src="https://img.shields.io/badge/version-0.2.0a1-18181b?style=flat-square" alt="Version 0.2.0a1" />
|
|
60
|
+
<img src="https://img.shields.io/badge/license-Apache--2.0-18181b?style=flat-square" alt="License Apache-2.0" />
|
|
61
|
+
<img src="https://img.shields.io/badge/typing-mypy%20strict-18181b?style=flat-square" alt="mypy strict" />
|
|
62
|
+
<img src="https://img.shields.io/badge/linter-ruff-18181b?style=flat-square" alt="ruff" />
|
|
63
|
+
<img src="https://img.shields.io/badge/telemetry-offline%20only-18181b?style=flat-square" alt="Offline Only" />
|
|
64
|
+
</p>
|
|
65
|
+
|
|
66
|
+
<p align="center">
|
|
67
|
+
<a href="#quick-start">Quick Start</a> •
|
|
68
|
+
<a href="#contracts">Contracts</a> •
|
|
69
|
+
<a href="#auto-remediation">Auto-Remediation</a> •
|
|
70
|
+
<a href="#web-ui--cli">Web UI & CLI</a> •
|
|
71
|
+
<a href="#documentation">Documentation</a>
|
|
72
|
+
</p>
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
**Buttress** enforces modular Python architecture locally with zero cloud dependencies or telemetry. It builds an exact module dependency graph cached in SQLite, validates structural contracts and explicit module policies, applies safe LibCST fixes with atomic rollback, tracks debt baselines, filters affected `pytest` targets from git diffs, and includes a loopback Web UI (`buttress show`).
|
|
77
|
+
|
|
78
|
+
## Table of Contents
|
|
79
|
+
|
|
80
|
+
- [Features](#features)
|
|
81
|
+
- [Installation](#installation)
|
|
82
|
+
- [Quick Start](#quick-start)
|
|
83
|
+
- [Configuration](#configuration)
|
|
84
|
+
- [Contracts](#contracts)
|
|
85
|
+
- [Auto-Remediation](#auto-remediation)
|
|
86
|
+
- [Web UI & CLI](#web-ui--cli)
|
|
87
|
+
- [Python SDK & CI](#python-sdk--ci)
|
|
88
|
+
- [Documentation](#documentation)
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Features
|
|
93
|
+
|
|
94
|
+
- **7 Built-in Contracts + Declarative Rules:** Enforce `layers`, `forbidden`, `protected`, `independence`, `acyclic_siblings`, `module_policy` (`[[modules]]`), `public_interface`, and `custom` governance rules.
|
|
95
|
+
- **Dependency Graph & Cache:** Incremental SQLite AST parsing with `Ca`, `Ce`, Instability (`I`), cycle detection, shortest-path traces, and external manifest verification (`buttress check-external`).
|
|
96
|
+
- **LibCST Auto-Remediation:** Automatically fix unused forbidden imports, `if TYPE_CHECKING:` guards, public facade rewrites, lazy imports, and stale inline ignores with SHA-256 verification and `--undo` rollback.
|
|
97
|
+
- **Baselines & Test Impact:** Adopt incrementally with fingerprinted `buttress.baseline.json` regression checks and run only diff-impacted tests via `buttress test` or `pytest --buttress-impact`.
|
|
98
|
+
- **Local Web UI & Reporting:** Inspect graphs, contracts, violations, diffs, and settings in `buttress show` (`127.0.0.1`), or export `JSON`, `SARIF 2.1.0`, `DOT`, and `Mermaid`.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Installation
|
|
103
|
+
|
|
104
|
+
Requires **Python `>= 3.10`**.
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Install from PyPI
|
|
108
|
+
pip install buttress
|
|
109
|
+
|
|
110
|
+
# Or isolate globally as a CLI tool with uv
|
|
111
|
+
uv tool install buttress
|
|
112
|
+
|
|
113
|
+
# Optional extras
|
|
114
|
+
pip install "buttress[test]" # pytest + coverage + networkx test helpers
|
|
115
|
+
pip install "buttress[e2e]" # playwright browser automation
|
|
116
|
+
pip install "buttress[dev]" # full contributor toolchain (test, e2e, mypy, ruff)
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Or install from source for local development:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
git clone https://github.com/v3ravani/buttress.git
|
|
123
|
+
cd buttress
|
|
124
|
+
uv sync --extra dev
|
|
125
|
+
uv run buttress doctor
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Quick Start
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
buttress init # Discover source roots and create buttress.toml
|
|
134
|
+
buttress scan # Build dependency graph & warm SQLite cache
|
|
135
|
+
buttress check # Evaluate all contracts and module policies
|
|
136
|
+
buttress show # Open the local Web UI (http://127.0.0.1:8765)
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Configuration
|
|
142
|
+
|
|
143
|
+
Settings load across 5 precedence tiers (`CLI flags` > `BUTTRESS_*` env vars > `buttress.toml` > `[tool.buttress]` in `pyproject.toml` > defaults).
|
|
144
|
+
|
|
145
|
+
```toml
|
|
146
|
+
source_roots = ["src"]
|
|
147
|
+
project_packages = ["ecommerce"]
|
|
148
|
+
strict = true
|
|
149
|
+
include_type_checking = true
|
|
150
|
+
|
|
151
|
+
[[contracts]]
|
|
152
|
+
name = "Clean Layers"
|
|
153
|
+
type = "layers"
|
|
154
|
+
containers = ["ecommerce"]
|
|
155
|
+
layers = ["web", "services", "domain", "models"]
|
|
156
|
+
|
|
157
|
+
[[contracts]]
|
|
158
|
+
name = "No Domain Web Imports"
|
|
159
|
+
type = "forbidden"
|
|
160
|
+
source_modules = ["ecommerce.domain"]
|
|
161
|
+
forbidden_modules = ["ecommerce.web"]
|
|
162
|
+
|
|
163
|
+
[[modules]]
|
|
164
|
+
path = "ecommerce.models"
|
|
165
|
+
depends_on = []
|
|
166
|
+
cannot_depend_on = ["ecommerce.web"]
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Contracts
|
|
172
|
+
|
|
173
|
+
| Type | Purpose | Key Fields |
|
|
174
|
+
| --- | --- | --- |
|
|
175
|
+
| `forbidden` | Block direct or indirect imports to forbidden targets | `source_modules`, `forbidden_modules` |
|
|
176
|
+
| `protected` | Restrict package imports to approved callers | `packages`, `allowed_importers` |
|
|
177
|
+
| `layers` | Enforce top-down dependency tiers | `layers`, `containers`, `closed` |
|
|
178
|
+
| `independence` | Enforce mutual isolation among peer slices | `modules` |
|
|
179
|
+
| `acyclic_siblings` | Prohibit dependency cycles under a parent package | `parent_package`, `recursive` |
|
|
180
|
+
| `module_policy` | Per-module `depends_on`, `cannot_depend_on`, `visibility` | Declared via `[[modules]]` |
|
|
181
|
+
| `public_interface` | Restrict imports to `__all__` / declared exports | `module_path`, `public_interface` |
|
|
182
|
+
| `custom` | Max fan-out, naming conventions, ownership, allowed/restricted imports | `capability` + rule fields |
|
|
183
|
+
|
|
184
|
+
Suppress a specific line temporarily with `# buttress: ignore[Contract Name]`, and audit rules for conflicts or stale ignores with `buttress contracts audit`. See [docs/contracts.md](docs/contracts.md) for all schemas.
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Auto-Remediation
|
|
189
|
+
|
|
190
|
+
Preview safe AST patches, apply atomically with mirrored `.bak` snapshots in `.buttress/backups/`, or roll back cleanly:
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
buttress fix # Preview unified CST diffs without modifying disk
|
|
194
|
+
buttress fix --apply # Apply eligible automatic fixes + verify post-fix
|
|
195
|
+
buttress fix --history # List remediation transaction ledger
|
|
196
|
+
buttress fix --undo <tx_id> # Restore pre-fix file states atomically
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Read [docs/remediation.md](docs/remediation.md) for all 6 built-in fixers and SHA-256 conflict guards.
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## Web UI & CLI
|
|
204
|
+
|
|
205
|
+
Launch the local monochrome dashboard (`127.0.0.1` loopback with strict `Host`, `Origin`, and `CSP` checks):
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
buttress show --port 8765
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Common daily CLI workflows:
|
|
212
|
+
|
|
213
|
+
| Command | Action |
|
|
214
|
+
| --- | --- |
|
|
215
|
+
| `buttress check` | Enforce contracts & auto-apply `buttress.baseline.json` (`--no-baseline` to inspect all) |
|
|
216
|
+
| `buttress sync --apply` | Sync `[[modules]]` `depends_on` lists cleanly with real imports |
|
|
217
|
+
| `buttress check-external` | Audit third-party imports against `pyproject.toml` / requirements files |
|
|
218
|
+
| `buttress test --base HEAD~1` | Compute impacted downstream `pytest` files from git diff |
|
|
219
|
+
| `buttress check -f sarif -o buttress.sarif` | Export findings as `sarif`, `json`, `text`, `github`, or `terminal` |
|
|
220
|
+
|
|
221
|
+
Full command options and exit codes (`0` to `130`) are documented in [docs/cli.md](docs/cli.md).
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## Python SDK & CI
|
|
226
|
+
|
|
227
|
+
```python
|
|
228
|
+
from pathlib import Path
|
|
229
|
+
from buttress.api import Project
|
|
230
|
+
|
|
231
|
+
project = Project.open(Path("."))
|
|
232
|
+
scan = project.scan()
|
|
233
|
+
active, suppressed, summary = project.check()
|
|
234
|
+
diff = project.compare_baseline(active)
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
In GitHub Actions, run `buttress check` and export SARIF via `buttress check -f sarif -o buttress.sarif`. For pre-commit, run `buttress install pre-commit`. For `pytest` test filtering, run `pytest --buttress-impact`.
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## Documentation
|
|
242
|
+
|
|
243
|
+
| Guide | Coverage |
|
|
244
|
+
| --- | --- |
|
|
245
|
+
| [Setup & Installation](docs/setup.md) | `uv` / `pip` setup, monorepos, initialization, and Web UI launch |
|
|
246
|
+
| [Requirements](docs/requirements.md) | Python versions, dependencies, OS support, and runtime constraints |
|
|
247
|
+
| [Contracts Specification](docs/contracts.md) | All 7 contract types, `[[modules]]`, custom capabilities, and audits |
|
|
248
|
+
| [Auto-Remediation](docs/remediation.md) | LibCST transform pipeline, built-in fixers, safety, and rollback |
|
|
249
|
+
| [CLI Reference](docs/cli.md) | Complete CLI commands, global flags, and exit codes |
|
|
250
|
+
| [SDK & REST API Reference](docs/api-reference.md) | Python `buttress.api` SDK and `/api/v1/*` server endpoints |
|
|
251
|
+
| [System Architecture](docs/system-architecture.md) | Package layers, concurrency locking, and atomic persistence |
|
|
252
|
+
| [Data Flow](docs/data-flow.md) | Scan caching, contract evaluation, and remediation pipelines |
|
|
253
|
+
| [Entity Relationships](docs/entity-relationship.md) | Domain models, graph entities, baseline, and transaction records |
|
|
254
|
+
| [Testing Guide](docs/testing.md) | Unit tests, `mypy --strict`, `ruff`, benchmarks, and Playwright E2E |
|
|
255
|
+
| [Security Model](docs/security.md) | Loopback isolation, Host/Origin/CSP checks, sandboxing, and VCS safety |
|
|
256
|
+
| [Troubleshooting](docs/troubleshooting.md) | Error codes (`CFG_*`, `RES_*`, `SEC_*`, `VCS_*`, `REM_*`) and fixes |
|
|
257
|
+
| [Contributing Guide](CONTRIBUTING.md) | Development workflow, verification checklist, and AI contribution rules |
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
<p align="center">
|
|
262
|
+
Licensed under the <strong>Apache License 2.0</strong><br />
|
|
263
|
+
Built by <a href="https://www.virajravani.in">Viraj Ravani</a>
|
|
264
|
+
</p>
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="docs/assets/buttress-logo.png" alt="Buttress Logo" width="132" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">Buttress</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<strong>Offline-first Python architecture governance, dependency graph analysis, and LibCST auto-remediation.</strong>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://pypi.org/project/buttress/"><img src="https://img.shields.io/pypi/v/buttress?color=18181b&style=flat-square" alt="PyPI" /></a>
|
|
13
|
+
<img src="https://img.shields.io/badge/python-%3E%3D3.10-18181b?style=flat-square&logo=python&logoColor=white" alt="Python >=3.10" />
|
|
14
|
+
<img src="https://img.shields.io/badge/version-0.2.0a1-18181b?style=flat-square" alt="Version 0.2.0a1" />
|
|
15
|
+
<img src="https://img.shields.io/badge/license-Apache--2.0-18181b?style=flat-square" alt="License Apache-2.0" />
|
|
16
|
+
<img src="https://img.shields.io/badge/typing-mypy%20strict-18181b?style=flat-square" alt="mypy strict" />
|
|
17
|
+
<img src="https://img.shields.io/badge/linter-ruff-18181b?style=flat-square" alt="ruff" />
|
|
18
|
+
<img src="https://img.shields.io/badge/telemetry-offline%20only-18181b?style=flat-square" alt="Offline Only" />
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
<p align="center">
|
|
22
|
+
<a href="#quick-start">Quick Start</a> •
|
|
23
|
+
<a href="#contracts">Contracts</a> •
|
|
24
|
+
<a href="#auto-remediation">Auto-Remediation</a> •
|
|
25
|
+
<a href="#web-ui--cli">Web UI & CLI</a> •
|
|
26
|
+
<a href="#documentation">Documentation</a>
|
|
27
|
+
</p>
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
**Buttress** enforces modular Python architecture locally with zero cloud dependencies or telemetry. It builds an exact module dependency graph cached in SQLite, validates structural contracts and explicit module policies, applies safe LibCST fixes with atomic rollback, tracks debt baselines, filters affected `pytest` targets from git diffs, and includes a loopback Web UI (`buttress show`).
|
|
32
|
+
|
|
33
|
+
## Table of Contents
|
|
34
|
+
|
|
35
|
+
- [Features](#features)
|
|
36
|
+
- [Installation](#installation)
|
|
37
|
+
- [Quick Start](#quick-start)
|
|
38
|
+
- [Configuration](#configuration)
|
|
39
|
+
- [Contracts](#contracts)
|
|
40
|
+
- [Auto-Remediation](#auto-remediation)
|
|
41
|
+
- [Web UI & CLI](#web-ui--cli)
|
|
42
|
+
- [Python SDK & CI](#python-sdk--ci)
|
|
43
|
+
- [Documentation](#documentation)
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Features
|
|
48
|
+
|
|
49
|
+
- **7 Built-in Contracts + Declarative Rules:** Enforce `layers`, `forbidden`, `protected`, `independence`, `acyclic_siblings`, `module_policy` (`[[modules]]`), `public_interface`, and `custom` governance rules.
|
|
50
|
+
- **Dependency Graph & Cache:** Incremental SQLite AST parsing with `Ca`, `Ce`, Instability (`I`), cycle detection, shortest-path traces, and external manifest verification (`buttress check-external`).
|
|
51
|
+
- **LibCST Auto-Remediation:** Automatically fix unused forbidden imports, `if TYPE_CHECKING:` guards, public facade rewrites, lazy imports, and stale inline ignores with SHA-256 verification and `--undo` rollback.
|
|
52
|
+
- **Baselines & Test Impact:** Adopt incrementally with fingerprinted `buttress.baseline.json` regression checks and run only diff-impacted tests via `buttress test` or `pytest --buttress-impact`.
|
|
53
|
+
- **Local Web UI & Reporting:** Inspect graphs, contracts, violations, diffs, and settings in `buttress show` (`127.0.0.1`), or export `JSON`, `SARIF 2.1.0`, `DOT`, and `Mermaid`.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Installation
|
|
58
|
+
|
|
59
|
+
Requires **Python `>= 3.10`**.
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# Install from PyPI
|
|
63
|
+
pip install buttress
|
|
64
|
+
|
|
65
|
+
# Or isolate globally as a CLI tool with uv
|
|
66
|
+
uv tool install buttress
|
|
67
|
+
|
|
68
|
+
# Optional extras
|
|
69
|
+
pip install "buttress[test]" # pytest + coverage + networkx test helpers
|
|
70
|
+
pip install "buttress[e2e]" # playwright browser automation
|
|
71
|
+
pip install "buttress[dev]" # full contributor toolchain (test, e2e, mypy, ruff)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Or install from source for local development:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
git clone https://github.com/v3ravani/buttress.git
|
|
78
|
+
cd buttress
|
|
79
|
+
uv sync --extra dev
|
|
80
|
+
uv run buttress doctor
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Quick Start
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
buttress init # Discover source roots and create buttress.toml
|
|
89
|
+
buttress scan # Build dependency graph & warm SQLite cache
|
|
90
|
+
buttress check # Evaluate all contracts and module policies
|
|
91
|
+
buttress show # Open the local Web UI (http://127.0.0.1:8765)
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Configuration
|
|
97
|
+
|
|
98
|
+
Settings load across 5 precedence tiers (`CLI flags` > `BUTTRESS_*` env vars > `buttress.toml` > `[tool.buttress]` in `pyproject.toml` > defaults).
|
|
99
|
+
|
|
100
|
+
```toml
|
|
101
|
+
source_roots = ["src"]
|
|
102
|
+
project_packages = ["ecommerce"]
|
|
103
|
+
strict = true
|
|
104
|
+
include_type_checking = true
|
|
105
|
+
|
|
106
|
+
[[contracts]]
|
|
107
|
+
name = "Clean Layers"
|
|
108
|
+
type = "layers"
|
|
109
|
+
containers = ["ecommerce"]
|
|
110
|
+
layers = ["web", "services", "domain", "models"]
|
|
111
|
+
|
|
112
|
+
[[contracts]]
|
|
113
|
+
name = "No Domain Web Imports"
|
|
114
|
+
type = "forbidden"
|
|
115
|
+
source_modules = ["ecommerce.domain"]
|
|
116
|
+
forbidden_modules = ["ecommerce.web"]
|
|
117
|
+
|
|
118
|
+
[[modules]]
|
|
119
|
+
path = "ecommerce.models"
|
|
120
|
+
depends_on = []
|
|
121
|
+
cannot_depend_on = ["ecommerce.web"]
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Contracts
|
|
127
|
+
|
|
128
|
+
| Type | Purpose | Key Fields |
|
|
129
|
+
| --- | --- | --- |
|
|
130
|
+
| `forbidden` | Block direct or indirect imports to forbidden targets | `source_modules`, `forbidden_modules` |
|
|
131
|
+
| `protected` | Restrict package imports to approved callers | `packages`, `allowed_importers` |
|
|
132
|
+
| `layers` | Enforce top-down dependency tiers | `layers`, `containers`, `closed` |
|
|
133
|
+
| `independence` | Enforce mutual isolation among peer slices | `modules` |
|
|
134
|
+
| `acyclic_siblings` | Prohibit dependency cycles under a parent package | `parent_package`, `recursive` |
|
|
135
|
+
| `module_policy` | Per-module `depends_on`, `cannot_depend_on`, `visibility` | Declared via `[[modules]]` |
|
|
136
|
+
| `public_interface` | Restrict imports to `__all__` / declared exports | `module_path`, `public_interface` |
|
|
137
|
+
| `custom` | Max fan-out, naming conventions, ownership, allowed/restricted imports | `capability` + rule fields |
|
|
138
|
+
|
|
139
|
+
Suppress a specific line temporarily with `# buttress: ignore[Contract Name]`, and audit rules for conflicts or stale ignores with `buttress contracts audit`. See [docs/contracts.md](docs/contracts.md) for all schemas.
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Auto-Remediation
|
|
144
|
+
|
|
145
|
+
Preview safe AST patches, apply atomically with mirrored `.bak` snapshots in `.buttress/backups/`, or roll back cleanly:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
buttress fix # Preview unified CST diffs without modifying disk
|
|
149
|
+
buttress fix --apply # Apply eligible automatic fixes + verify post-fix
|
|
150
|
+
buttress fix --history # List remediation transaction ledger
|
|
151
|
+
buttress fix --undo <tx_id> # Restore pre-fix file states atomically
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Read [docs/remediation.md](docs/remediation.md) for all 6 built-in fixers and SHA-256 conflict guards.
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Web UI & CLI
|
|
159
|
+
|
|
160
|
+
Launch the local monochrome dashboard (`127.0.0.1` loopback with strict `Host`, `Origin`, and `CSP` checks):
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
buttress show --port 8765
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Common daily CLI workflows:
|
|
167
|
+
|
|
168
|
+
| Command | Action |
|
|
169
|
+
| --- | --- |
|
|
170
|
+
| `buttress check` | Enforce contracts & auto-apply `buttress.baseline.json` (`--no-baseline` to inspect all) |
|
|
171
|
+
| `buttress sync --apply` | Sync `[[modules]]` `depends_on` lists cleanly with real imports |
|
|
172
|
+
| `buttress check-external` | Audit third-party imports against `pyproject.toml` / requirements files |
|
|
173
|
+
| `buttress test --base HEAD~1` | Compute impacted downstream `pytest` files from git diff |
|
|
174
|
+
| `buttress check -f sarif -o buttress.sarif` | Export findings as `sarif`, `json`, `text`, `github`, or `terminal` |
|
|
175
|
+
|
|
176
|
+
Full command options and exit codes (`0` to `130`) are documented in [docs/cli.md](docs/cli.md).
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Python SDK & CI
|
|
181
|
+
|
|
182
|
+
```python
|
|
183
|
+
from pathlib import Path
|
|
184
|
+
from buttress.api import Project
|
|
185
|
+
|
|
186
|
+
project = Project.open(Path("."))
|
|
187
|
+
scan = project.scan()
|
|
188
|
+
active, suppressed, summary = project.check()
|
|
189
|
+
diff = project.compare_baseline(active)
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
In GitHub Actions, run `buttress check` and export SARIF via `buttress check -f sarif -o buttress.sarif`. For pre-commit, run `buttress install pre-commit`. For `pytest` test filtering, run `pytest --buttress-impact`.
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Documentation
|
|
197
|
+
|
|
198
|
+
| Guide | Coverage |
|
|
199
|
+
| --- | --- |
|
|
200
|
+
| [Setup & Installation](docs/setup.md) | `uv` / `pip` setup, monorepos, initialization, and Web UI launch |
|
|
201
|
+
| [Requirements](docs/requirements.md) | Python versions, dependencies, OS support, and runtime constraints |
|
|
202
|
+
| [Contracts Specification](docs/contracts.md) | All 7 contract types, `[[modules]]`, custom capabilities, and audits |
|
|
203
|
+
| [Auto-Remediation](docs/remediation.md) | LibCST transform pipeline, built-in fixers, safety, and rollback |
|
|
204
|
+
| [CLI Reference](docs/cli.md) | Complete CLI commands, global flags, and exit codes |
|
|
205
|
+
| [SDK & REST API Reference](docs/api-reference.md) | Python `buttress.api` SDK and `/api/v1/*` server endpoints |
|
|
206
|
+
| [System Architecture](docs/system-architecture.md) | Package layers, concurrency locking, and atomic persistence |
|
|
207
|
+
| [Data Flow](docs/data-flow.md) | Scan caching, contract evaluation, and remediation pipelines |
|
|
208
|
+
| [Entity Relationships](docs/entity-relationship.md) | Domain models, graph entities, baseline, and transaction records |
|
|
209
|
+
| [Testing Guide](docs/testing.md) | Unit tests, `mypy --strict`, `ruff`, benchmarks, and Playwright E2E |
|
|
210
|
+
| [Security Model](docs/security.md) | Loopback isolation, Host/Origin/CSP checks, sandboxing, and VCS safety |
|
|
211
|
+
| [Troubleshooting](docs/troubleshooting.md) | Error codes (`CFG_*`, `RES_*`, `SEC_*`, `VCS_*`, `REM_*`) and fixes |
|
|
212
|
+
| [Contributing Guide](CONTRIBUTING.md) | Development workflow, verification checklist, and AI contribution rules |
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
<p align="center">
|
|
217
|
+
Licensed under the <strong>Apache License 2.0</strong><br />
|
|
218
|
+
Built by <a href="https://www.virajravani.in">Viraj Ravani</a>
|
|
219
|
+
</p>
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77.0.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "buttress"
|
|
7
|
+
version = "0.2.0a1"
|
|
8
|
+
description = "Enterprise-grade Python architecture analysis and enforcement"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "Apache-2.0"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [
|
|
14
|
+
{name = "viraj ravani", email = "ravaniviraj@gmail.com"}
|
|
15
|
+
]
|
|
16
|
+
keywords = [
|
|
17
|
+
"architecture",
|
|
18
|
+
"dependency-analysis",
|
|
19
|
+
"import-linter",
|
|
20
|
+
"tach",
|
|
21
|
+
"static-analysis",
|
|
22
|
+
"layer-architecture",
|
|
23
|
+
"linter"
|
|
24
|
+
]
|
|
25
|
+
classifiers = [
|
|
26
|
+
"Development Status :: 3 - Alpha",
|
|
27
|
+
"Intended Audience :: Developers",
|
|
28
|
+
"Operating System :: OS Independent",
|
|
29
|
+
"Programming Language :: Python :: 3",
|
|
30
|
+
"Programming Language :: Python :: 3.10",
|
|
31
|
+
"Programming Language :: Python :: 3.11",
|
|
32
|
+
"Programming Language :: Python :: 3.12",
|
|
33
|
+
"Programming Language :: Python :: 3.13",
|
|
34
|
+
"Programming Language :: Python :: 3.14",
|
|
35
|
+
"Topic :: Software Development :: Quality Assurance",
|
|
36
|
+
"Topic :: Software Development :: Testing",
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
dependencies = [
|
|
40
|
+
"click>=8.1.0",
|
|
41
|
+
"rich>=13.0.0",
|
|
42
|
+
"pydantic>=2.5.0",
|
|
43
|
+
"grimp>=3.2.0",
|
|
44
|
+
"libcst>=1.1.0",
|
|
45
|
+
"tomli-w>=1.0.0",
|
|
46
|
+
"tomli>=2.0.0; python_version < '3.11'",
|
|
47
|
+
"pathspec>=0.11.0",
|
|
48
|
+
"packaging>=21.0",
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
[project.optional-dependencies]
|
|
52
|
+
test = [
|
|
53
|
+
"pytest>=7.0.0",
|
|
54
|
+
"pytest-cov>=4.0.0",
|
|
55
|
+
"networkx>=3.0",
|
|
56
|
+
]
|
|
57
|
+
e2e = [
|
|
58
|
+
"playwright>=1.40.0",
|
|
59
|
+
]
|
|
60
|
+
dev = [
|
|
61
|
+
"pytest>=7.0.0",
|
|
62
|
+
"pytest-cov>=4.0.0",
|
|
63
|
+
"networkx>=3.0",
|
|
64
|
+
"playwright>=1.40.0",
|
|
65
|
+
"ruff",
|
|
66
|
+
"mypy",
|
|
67
|
+
]
|
|
68
|
+
|
|
69
|
+
[project.scripts]
|
|
70
|
+
buttress = "buttress.cli.entrypoint:cli"
|
|
71
|
+
|
|
72
|
+
[project.entry-points.pytest11]
|
|
73
|
+
buttress = "buttress.integrations.pytest_plugin"
|
|
74
|
+
|
|
75
|
+
[tool.setuptools.packages.find]
|
|
76
|
+
where = ["src"]
|
|
77
|
+
|
|
78
|
+
[tool.setuptools.package-data]
|
|
79
|
+
buttress = ["py.typed", "server/static/**/*"]
|
|
80
|
+
|
|
81
|
+
[tool.pytest.ini_options]
|
|
82
|
+
minversion = "7.0"
|
|
83
|
+
testpaths = ["tests"]
|
|
84
|
+
python_files = ["test_*.py"]
|
|
85
|
+
python_classes = ["Test*"]
|
|
86
|
+
python_functions = ["test_*"]
|
|
87
|
+
addopts = "-v --strict-markers"
|
|
88
|
+
asyncio_mode = "strict"
|
|
89
|
+
asyncio_default_fixture_loop_scope = "function"
|
|
90
|
+
|
|
91
|
+
[tool.ruff]
|
|
92
|
+
line-length = 100
|
|
93
|
+
target-version = "py310"
|
|
94
|
+
|
|
95
|
+
[tool.ruff.lint]
|
|
96
|
+
select = ["E", "F", "W", "B", "I"]
|
|
97
|
+
ignore = ["E501"]
|
|
98
|
+
|
|
99
|
+
[tool.mypy]
|
|
100
|
+
python_version = "3.10"
|
|
101
|
+
strict = true
|
|
102
|
+
warn_unused_configs = true
|
|
103
|
+
disallow_untyped_defs = true
|
|
104
|
+
disallow_incomplete_defs = true
|
|
105
|
+
check_untyped_defs = true
|
|
106
|
+
no_implicit_optional = true
|
|
107
|
+
warn_redundant_casts = true
|
|
108
|
+
warn_unused_ignores = true
|
|
109
|
+
warn_return_any = true
|
|
110
|
+
|
|
111
|
+
[[tool.mypy.overrides]]
|
|
112
|
+
module = ["tomli"]
|
|
113
|
+
ignore_missing_imports = true
|
|
114
|
+
|
|
115
|
+
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"""Buttress — Enterprise-grade Python architecture analysis and enforcement."""
|
|
2
|
+
|
|
3
|
+
from buttress.contracts.base import ContractBase
|
|
4
|
+
from buttress.contracts.registry import ContractMetadata, ContractRegistry
|
|
5
|
+
from buttress.domain import (
|
|
6
|
+
BaseContract,
|
|
7
|
+
Baseline,
|
|
8
|
+
ContractResult,
|
|
9
|
+
DependencyEdge,
|
|
10
|
+
DependencyGraph,
|
|
11
|
+
Finding,
|
|
12
|
+
ImportKind,
|
|
13
|
+
ImportSite,
|
|
14
|
+
ImportStatement,
|
|
15
|
+
Module,
|
|
16
|
+
ModuleId,
|
|
17
|
+
ModulePolicy,
|
|
18
|
+
Project,
|
|
19
|
+
Severity,
|
|
20
|
+
SourceFile,
|
|
21
|
+
SourceLocation,
|
|
22
|
+
SourceRoot,
|
|
23
|
+
Suppression,
|
|
24
|
+
SuppressionKind,
|
|
25
|
+
SuppressionManager,
|
|
26
|
+
WorkspaceId,
|
|
27
|
+
)
|
|
28
|
+
from buttress.plugins.loader import PluginLoader
|
|
29
|
+
from buttress.plugins.manager import PluginManager
|
|
30
|
+
from buttress.version import VERSION, __version__
|
|
31
|
+
|
|
32
|
+
__all__ = [
|
|
33
|
+
"__version__",
|
|
34
|
+
"VERSION",
|
|
35
|
+
# Domain Models
|
|
36
|
+
"Project",
|
|
37
|
+
"WorkspaceId",
|
|
38
|
+
"SourceRoot",
|
|
39
|
+
"ModuleId",
|
|
40
|
+
"Module",
|
|
41
|
+
"SourceFile",
|
|
42
|
+
"SourceLocation",
|
|
43
|
+
"ImportStatement",
|
|
44
|
+
"ImportKind",
|
|
45
|
+
"ImportSite",
|
|
46
|
+
"DependencyEdge",
|
|
47
|
+
"DependencyGraph",
|
|
48
|
+
"Finding",
|
|
49
|
+
"Severity",
|
|
50
|
+
"BaseContract",
|
|
51
|
+
"ContractBase",
|
|
52
|
+
"ContractMetadata",
|
|
53
|
+
"ContractRegistry",
|
|
54
|
+
"PluginLoader",
|
|
55
|
+
"PluginManager",
|
|
56
|
+
"ContractResult",
|
|
57
|
+
"ModulePolicy",
|
|
58
|
+
"Suppression",
|
|
59
|
+
"SuppressionKind",
|
|
60
|
+
"SuppressionManager",
|
|
61
|
+
"Baseline",
|
|
62
|
+
]
|
|
63
|
+
|