deploy-guard-engine 0.1.2__tar.gz → 0.1.3__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.
- deploy_guard_engine-0.1.3/PKG-INFO +169 -0
- deploy_guard_engine-0.1.3/README.md +135 -0
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/pyproject.toml +1 -1
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/__init__.py +1 -1
- deploy_guard_engine-0.1.3/src/deploy_guard_engine.egg-info/PKG-INFO +169 -0
- deploy_guard_engine-0.1.2/PKG-INFO +0 -37
- deploy_guard_engine-0.1.2/README.md +0 -3
- deploy_guard_engine-0.1.2/src/deploy_guard_engine.egg-info/PKG-INFO +0 -37
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/LICENSE +0 -0
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/setup.cfg +0 -0
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/__main__.py +0 -0
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/analysis/__init__.py +0 -0
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/analysis/callgraph.py +0 -0
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/analysis/context.py +0 -0
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/analysis/findings.py +0 -0
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/analysis/nullability.py +0 -0
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/analysis/paths.py +0 -0
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/cli.py +0 -0
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/config.py +0 -0
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/engine.py +0 -0
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/explain/__init__.py +0 -0
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/explain/explainer.py +0 -0
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/explain/render.py +0 -0
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/explain/traceback_parse.py +0 -0
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/frontend/__init__.py +0 -0
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/frontend/python_cfg.py +0 -0
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/frontend/python_frontend.py +0 -0
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/generators/__init__.py +0 -0
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/generators/base.py +0 -0
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/generators/import_smoke.py +0 -0
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/ingest/__init__.py +0 -0
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/ingest/discover.py +0 -0
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/ir/__init__.py +0 -0
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/ir/cfg.py +0 -0
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/ir/model.py +0 -0
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/py.typed +0 -0
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/report/__init__.py +0 -0
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/report/render.py +0 -0
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/store.py +0 -0
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard_engine.egg-info/SOURCES.txt +0 -0
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard_engine.egg-info/dependency_links.txt +0 -0
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard_engine.egg-info/entry_points.txt +0 -0
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard_engine.egg-info/requires.txt +0 -0
- {deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard_engine.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: deploy-guard-engine
|
|
3
|
+
Version: 0.1.3
|
|
4
|
+
Summary: Static root-cause analysis for a Python stack trace - offline, no account. Plus a deployment-gate scanner.
|
|
5
|
+
Author: sai55387
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Dineshsai7/deploy-guard-engine
|
|
8
|
+
Project-URL: Issues, https://github.com/Dineshsai7/deploy-guard-engine/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/Dineshsai7/deploy-guard-engine/blob/main/CHANGELOG.md
|
|
10
|
+
Keywords: traceback,stacktrace,root-cause,debugging,static-analysis,control-flow,nullability,deployment,ci,incident
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Software Development :: Debuggers
|
|
22
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
23
|
+
Classifier: Topic :: Software Development :: Testing
|
|
24
|
+
Requires-Python: >=3.10
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
29
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
30
|
+
Requires-Dist: ruff; extra == "dev"
|
|
31
|
+
Requires-Dist: build; extra == "dev"
|
|
32
|
+
Requires-Dist: twine; extra == "dev"
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
# deploy-guard
|
|
36
|
+
|
|
37
|
+
**Static root-cause analysis for a Python stack trace.** Paste a traceback,
|
|
38
|
+
point it at the repo, and get: which variable is `None` and *why*, the branch
|
|
39
|
+
path that reached the crash, where the bad value entered across the call
|
|
40
|
+
chain, and a concrete fix. Fully local — no server, no account, no
|
|
41
|
+
network. Zero dependencies. Python 3.10+.
|
|
42
|
+
|
|
43
|
+
It also ships a deployment-gate scanner (`scan` / `check`), but for
|
|
44
|
+
general-purpose linting you should run **[ruff](https://docs.astral.sh/ruff/)
|
|
45
|
+
+ [mypy](https://mypy-lang.org/)** — they are faster and deeper. What
|
|
46
|
+
deploy-guard does that they don't is turn *a traceback you already have* into
|
|
47
|
+
an explanation grounded in your code.
|
|
48
|
+
|
|
49
|
+
## Install
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install deploy-guard-engine # or: pipx install deploy-guard-engine
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Or run it with no install at all — a single ~120 KB file:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
./scripts/build-standalone.sh # -> dist/deploy-guard.pyz
|
|
59
|
+
python deploy-guard.pyz explain --project ./service < traceback.txt
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Explain a traceback
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
deploy-guard explain --project ./service --file traceback.txt
|
|
66
|
+
# or pipe it
|
|
67
|
+
deploy-guard explain --project ./service < traceback.txt
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
Explaining: AttributeError: 'NoneType' object has no attribute 'empty'
|
|
72
|
+
|
|
73
|
+
Crash site: project_folder/file_name.py:231 — create_json
|
|
74
|
+
|
|
75
|
+
231 | if _df.empty or _df is None:
|
|
76
|
+
|
|
77
|
+
Why:
|
|
78
|
+
|
|
79
|
+
_df can be None because the default value passed to .get() is None.
|
|
80
|
+
|
|
81
|
+
It reaches this line when processing report_dict.
|
|
82
|
+
|
|
83
|
+
Although the condition checks _df is None, Python evaluates the or expression from left to right.
|
|
84
|
+
|
|
85
|
+
Therefore, _df.empty is evaluated first. If _df is None, this raises an AttributeError before the None check is reached.
|
|
86
|
+
|
|
87
|
+
Call chain (from the traceback):
|
|
88
|
+
|
|
89
|
+
project_file:164 function_name
|
|
90
|
+
└─ file_locator.py:231 create_json <- exception raised
|
|
91
|
+
|
|
92
|
+
Scan finding:
|
|
93
|
+
none-dereference (block) at file_locator.py:231
|
|
94
|
+
|
|
95
|
+
Fix:
|
|
96
|
+
Reorder the condition so _df is None is checked first:
|
|
97
|
+
|
|
98
|
+
if _df is None or _df.empty:
|
|
99
|
+
|
|
100
|
+
This ensures _df.empty is only accessed when _df is not None.
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Dedicated explanations for `AttributeError` / `TypeError` (None), `KeyError`,
|
|
104
|
+
`IndexError`, `ZeroDivisionError`, `UnboundLocalError`, `NameError`, and
|
|
105
|
+
`int()` / `float()` `ValueError`. Anything else falls back to the call chain
|
|
106
|
+
+ the branch conditions that reach the line. The call chain is analysed
|
|
107
|
+
*interprocedurally* — each project frame is checked, and a `None` that
|
|
108
|
+
originates in an argument is traced back to the caller that passed it.
|
|
109
|
+
|
|
110
|
+
## Scan a project
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
deploy-guard scan ./service # report, never fails
|
|
114
|
+
deploy-guard scan ./service --behavior # + the when-X-returns-Y table
|
|
115
|
+
deploy-guard check ./service --fail-on review # gate: exit 1 on findings
|
|
116
|
+
deploy-guard scan ./service --report report.json
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
| Rule | Severity | Catches |
|
|
120
|
+
|---|---|---|
|
|
121
|
+
| `none-dereference` | block / review | attr/subscript on a possibly-`None` value (interprocedural: a call to a project function that can return `None` counts) |
|
|
122
|
+
| `inconsistent-return` | review / note | returns a value on some paths, `None` on others — **review only when an in-project caller uses the result without a guard**, otherwise a note |
|
|
123
|
+
| `swallowed-exception` | review | `except …: pass` |
|
|
124
|
+
| `unreachable-code` | warn | code after an always-diverting branch |
|
|
125
|
+
| `bare-except` | warn | `except:` with no type |
|
|
126
|
+
| `mutable-default-arg` | warn | `def f(x=[])` |
|
|
127
|
+
| `invalid-escape` | note | `"\d"` in a non-raw string |
|
|
128
|
+
| `path-explosion` | note | too-branchy function (detection still complete) |
|
|
129
|
+
|
|
130
|
+
Notes are collapsed to a one-line count; `--notes` lists them. Identical
|
|
131
|
+
findings from copy-pasted functions fold into one; `--no-collapse` expands.
|
|
132
|
+
|
|
133
|
+
## Configuration
|
|
134
|
+
|
|
135
|
+
A `[tool.deploy-guard]` table in the **scanned project's** `pyproject.toml`
|
|
136
|
+
(Python 3.11+ for TOML reading):
|
|
137
|
+
|
|
138
|
+
```toml
|
|
139
|
+
[tool.deploy-guard]
|
|
140
|
+
disable = ["bare-except"]
|
|
141
|
+
exclude = ["vendor", "migrations"]
|
|
142
|
+
fail-on = "review"
|
|
143
|
+
include-tests = false
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
CLI flags override the file.
|
|
147
|
+
|
|
148
|
+
## How it works
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
discover -> lower to IR -> CFG per function -> call graph
|
|
152
|
+
-> behavior spec (path conditions -> returns/raises)
|
|
153
|
+
-> nullability data-flow (merges None facts at every branch join; interprocedural)
|
|
154
|
+
-> findings | explain (traceback -> the above, focused on one failure)
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
The nullability pass is a forward fixpoint over the CFG — it merges
|
|
158
|
+
facts at branch joins, so it covers 100% of a function regardless of how
|
|
159
|
+
branchy it is, in roughly linear time.
|
|
160
|
+
|
|
161
|
+
`scan` and `explain` only **read** your code — never import or run it.
|
|
162
|
+
|
|
163
|
+
## Develop
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
pip install -e ".[dev]"
|
|
167
|
+
pytest
|
|
168
|
+
ruff check src
|
|
169
|
+
```
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# deploy-guard
|
|
2
|
+
|
|
3
|
+
**Static root-cause analysis for a Python stack trace.** Paste a traceback,
|
|
4
|
+
point it at the repo, and get: which variable is `None` and *why*, the branch
|
|
5
|
+
path that reached the crash, where the bad value entered across the call
|
|
6
|
+
chain, and a concrete fix. Fully local — no server, no account, no
|
|
7
|
+
network. Zero dependencies. Python 3.10+.
|
|
8
|
+
|
|
9
|
+
It also ships a deployment-gate scanner (`scan` / `check`), but for
|
|
10
|
+
general-purpose linting you should run **[ruff](https://docs.astral.sh/ruff/)
|
|
11
|
+
+ [mypy](https://mypy-lang.org/)** — they are faster and deeper. What
|
|
12
|
+
deploy-guard does that they don't is turn *a traceback you already have* into
|
|
13
|
+
an explanation grounded in your code.
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pip install deploy-guard-engine # or: pipx install deploy-guard-engine
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Or run it with no install at all — a single ~120 KB file:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
./scripts/build-standalone.sh # -> dist/deploy-guard.pyz
|
|
25
|
+
python deploy-guard.pyz explain --project ./service < traceback.txt
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Explain a traceback
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
deploy-guard explain --project ./service --file traceback.txt
|
|
32
|
+
# or pipe it
|
|
33
|
+
deploy-guard explain --project ./service < traceback.txt
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
Explaining: AttributeError: 'NoneType' object has no attribute 'empty'
|
|
38
|
+
|
|
39
|
+
Crash site: project_folder/file_name.py:231 — create_json
|
|
40
|
+
|
|
41
|
+
231 | if _df.empty or _df is None:
|
|
42
|
+
|
|
43
|
+
Why:
|
|
44
|
+
|
|
45
|
+
_df can be None because the default value passed to .get() is None.
|
|
46
|
+
|
|
47
|
+
It reaches this line when processing report_dict.
|
|
48
|
+
|
|
49
|
+
Although the condition checks _df is None, Python evaluates the or expression from left to right.
|
|
50
|
+
|
|
51
|
+
Therefore, _df.empty is evaluated first. If _df is None, this raises an AttributeError before the None check is reached.
|
|
52
|
+
|
|
53
|
+
Call chain (from the traceback):
|
|
54
|
+
|
|
55
|
+
project_file:164 function_name
|
|
56
|
+
└─ file_locator.py:231 create_json <- exception raised
|
|
57
|
+
|
|
58
|
+
Scan finding:
|
|
59
|
+
none-dereference (block) at file_locator.py:231
|
|
60
|
+
|
|
61
|
+
Fix:
|
|
62
|
+
Reorder the condition so _df is None is checked first:
|
|
63
|
+
|
|
64
|
+
if _df is None or _df.empty:
|
|
65
|
+
|
|
66
|
+
This ensures _df.empty is only accessed when _df is not None.
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Dedicated explanations for `AttributeError` / `TypeError` (None), `KeyError`,
|
|
70
|
+
`IndexError`, `ZeroDivisionError`, `UnboundLocalError`, `NameError`, and
|
|
71
|
+
`int()` / `float()` `ValueError`. Anything else falls back to the call chain
|
|
72
|
+
+ the branch conditions that reach the line. The call chain is analysed
|
|
73
|
+
*interprocedurally* — each project frame is checked, and a `None` that
|
|
74
|
+
originates in an argument is traced back to the caller that passed it.
|
|
75
|
+
|
|
76
|
+
## Scan a project
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
deploy-guard scan ./service # report, never fails
|
|
80
|
+
deploy-guard scan ./service --behavior # + the when-X-returns-Y table
|
|
81
|
+
deploy-guard check ./service --fail-on review # gate: exit 1 on findings
|
|
82
|
+
deploy-guard scan ./service --report report.json
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
| Rule | Severity | Catches |
|
|
86
|
+
|---|---|---|
|
|
87
|
+
| `none-dereference` | block / review | attr/subscript on a possibly-`None` value (interprocedural: a call to a project function that can return `None` counts) |
|
|
88
|
+
| `inconsistent-return` | review / note | returns a value on some paths, `None` on others — **review only when an in-project caller uses the result without a guard**, otherwise a note |
|
|
89
|
+
| `swallowed-exception` | review | `except …: pass` |
|
|
90
|
+
| `unreachable-code` | warn | code after an always-diverting branch |
|
|
91
|
+
| `bare-except` | warn | `except:` with no type |
|
|
92
|
+
| `mutable-default-arg` | warn | `def f(x=[])` |
|
|
93
|
+
| `invalid-escape` | note | `"\d"` in a non-raw string |
|
|
94
|
+
| `path-explosion` | note | too-branchy function (detection still complete) |
|
|
95
|
+
|
|
96
|
+
Notes are collapsed to a one-line count; `--notes` lists them. Identical
|
|
97
|
+
findings from copy-pasted functions fold into one; `--no-collapse` expands.
|
|
98
|
+
|
|
99
|
+
## Configuration
|
|
100
|
+
|
|
101
|
+
A `[tool.deploy-guard]` table in the **scanned project's** `pyproject.toml`
|
|
102
|
+
(Python 3.11+ for TOML reading):
|
|
103
|
+
|
|
104
|
+
```toml
|
|
105
|
+
[tool.deploy-guard]
|
|
106
|
+
disable = ["bare-except"]
|
|
107
|
+
exclude = ["vendor", "migrations"]
|
|
108
|
+
fail-on = "review"
|
|
109
|
+
include-tests = false
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
CLI flags override the file.
|
|
113
|
+
|
|
114
|
+
## How it works
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
discover -> lower to IR -> CFG per function -> call graph
|
|
118
|
+
-> behavior spec (path conditions -> returns/raises)
|
|
119
|
+
-> nullability data-flow (merges None facts at every branch join; interprocedural)
|
|
120
|
+
-> findings | explain (traceback -> the above, focused on one failure)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
The nullability pass is a forward fixpoint over the CFG — it merges
|
|
124
|
+
facts at branch joins, so it covers 100% of a function regardless of how
|
|
125
|
+
branchy it is, in roughly linear time.
|
|
126
|
+
|
|
127
|
+
`scan` and `explain` only **read** your code — never import or run it.
|
|
128
|
+
|
|
129
|
+
## Develop
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
pip install -e ".[dev]"
|
|
133
|
+
pytest
|
|
134
|
+
ruff check src
|
|
135
|
+
```
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "deploy-guard-engine"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.3"
|
|
8
8
|
description = "Static root-cause analysis for a Python stack trace - offline, no account. Plus a deployment-gate scanner."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: deploy-guard-engine
|
|
3
|
+
Version: 0.1.3
|
|
4
|
+
Summary: Static root-cause analysis for a Python stack trace - offline, no account. Plus a deployment-gate scanner.
|
|
5
|
+
Author: sai55387
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Dineshsai7/deploy-guard-engine
|
|
8
|
+
Project-URL: Issues, https://github.com/Dineshsai7/deploy-guard-engine/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/Dineshsai7/deploy-guard-engine/blob/main/CHANGELOG.md
|
|
10
|
+
Keywords: traceback,stacktrace,root-cause,debugging,static-analysis,control-flow,nullability,deployment,ci,incident
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Software Development :: Debuggers
|
|
22
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
23
|
+
Classifier: Topic :: Software Development :: Testing
|
|
24
|
+
Requires-Python: >=3.10
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
29
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
30
|
+
Requires-Dist: ruff; extra == "dev"
|
|
31
|
+
Requires-Dist: build; extra == "dev"
|
|
32
|
+
Requires-Dist: twine; extra == "dev"
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
# deploy-guard
|
|
36
|
+
|
|
37
|
+
**Static root-cause analysis for a Python stack trace.** Paste a traceback,
|
|
38
|
+
point it at the repo, and get: which variable is `None` and *why*, the branch
|
|
39
|
+
path that reached the crash, where the bad value entered across the call
|
|
40
|
+
chain, and a concrete fix. Fully local — no server, no account, no
|
|
41
|
+
network. Zero dependencies. Python 3.10+.
|
|
42
|
+
|
|
43
|
+
It also ships a deployment-gate scanner (`scan` / `check`), but for
|
|
44
|
+
general-purpose linting you should run **[ruff](https://docs.astral.sh/ruff/)
|
|
45
|
+
+ [mypy](https://mypy-lang.org/)** — they are faster and deeper. What
|
|
46
|
+
deploy-guard does that they don't is turn *a traceback you already have* into
|
|
47
|
+
an explanation grounded in your code.
|
|
48
|
+
|
|
49
|
+
## Install
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install deploy-guard-engine # or: pipx install deploy-guard-engine
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Or run it with no install at all — a single ~120 KB file:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
./scripts/build-standalone.sh # -> dist/deploy-guard.pyz
|
|
59
|
+
python deploy-guard.pyz explain --project ./service < traceback.txt
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Explain a traceback
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
deploy-guard explain --project ./service --file traceback.txt
|
|
66
|
+
# or pipe it
|
|
67
|
+
deploy-guard explain --project ./service < traceback.txt
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
Explaining: AttributeError: 'NoneType' object has no attribute 'empty'
|
|
72
|
+
|
|
73
|
+
Crash site: project_folder/file_name.py:231 — create_json
|
|
74
|
+
|
|
75
|
+
231 | if _df.empty or _df is None:
|
|
76
|
+
|
|
77
|
+
Why:
|
|
78
|
+
|
|
79
|
+
_df can be None because the default value passed to .get() is None.
|
|
80
|
+
|
|
81
|
+
It reaches this line when processing report_dict.
|
|
82
|
+
|
|
83
|
+
Although the condition checks _df is None, Python evaluates the or expression from left to right.
|
|
84
|
+
|
|
85
|
+
Therefore, _df.empty is evaluated first. If _df is None, this raises an AttributeError before the None check is reached.
|
|
86
|
+
|
|
87
|
+
Call chain (from the traceback):
|
|
88
|
+
|
|
89
|
+
project_file:164 function_name
|
|
90
|
+
└─ file_locator.py:231 create_json <- exception raised
|
|
91
|
+
|
|
92
|
+
Scan finding:
|
|
93
|
+
none-dereference (block) at file_locator.py:231
|
|
94
|
+
|
|
95
|
+
Fix:
|
|
96
|
+
Reorder the condition so _df is None is checked first:
|
|
97
|
+
|
|
98
|
+
if _df is None or _df.empty:
|
|
99
|
+
|
|
100
|
+
This ensures _df.empty is only accessed when _df is not None.
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Dedicated explanations for `AttributeError` / `TypeError` (None), `KeyError`,
|
|
104
|
+
`IndexError`, `ZeroDivisionError`, `UnboundLocalError`, `NameError`, and
|
|
105
|
+
`int()` / `float()` `ValueError`. Anything else falls back to the call chain
|
|
106
|
+
+ the branch conditions that reach the line. The call chain is analysed
|
|
107
|
+
*interprocedurally* — each project frame is checked, and a `None` that
|
|
108
|
+
originates in an argument is traced back to the caller that passed it.
|
|
109
|
+
|
|
110
|
+
## Scan a project
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
deploy-guard scan ./service # report, never fails
|
|
114
|
+
deploy-guard scan ./service --behavior # + the when-X-returns-Y table
|
|
115
|
+
deploy-guard check ./service --fail-on review # gate: exit 1 on findings
|
|
116
|
+
deploy-guard scan ./service --report report.json
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
| Rule | Severity | Catches |
|
|
120
|
+
|---|---|---|
|
|
121
|
+
| `none-dereference` | block / review | attr/subscript on a possibly-`None` value (interprocedural: a call to a project function that can return `None` counts) |
|
|
122
|
+
| `inconsistent-return` | review / note | returns a value on some paths, `None` on others — **review only when an in-project caller uses the result without a guard**, otherwise a note |
|
|
123
|
+
| `swallowed-exception` | review | `except …: pass` |
|
|
124
|
+
| `unreachable-code` | warn | code after an always-diverting branch |
|
|
125
|
+
| `bare-except` | warn | `except:` with no type |
|
|
126
|
+
| `mutable-default-arg` | warn | `def f(x=[])` |
|
|
127
|
+
| `invalid-escape` | note | `"\d"` in a non-raw string |
|
|
128
|
+
| `path-explosion` | note | too-branchy function (detection still complete) |
|
|
129
|
+
|
|
130
|
+
Notes are collapsed to a one-line count; `--notes` lists them. Identical
|
|
131
|
+
findings from copy-pasted functions fold into one; `--no-collapse` expands.
|
|
132
|
+
|
|
133
|
+
## Configuration
|
|
134
|
+
|
|
135
|
+
A `[tool.deploy-guard]` table in the **scanned project's** `pyproject.toml`
|
|
136
|
+
(Python 3.11+ for TOML reading):
|
|
137
|
+
|
|
138
|
+
```toml
|
|
139
|
+
[tool.deploy-guard]
|
|
140
|
+
disable = ["bare-except"]
|
|
141
|
+
exclude = ["vendor", "migrations"]
|
|
142
|
+
fail-on = "review"
|
|
143
|
+
include-tests = false
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
CLI flags override the file.
|
|
147
|
+
|
|
148
|
+
## How it works
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
discover -> lower to IR -> CFG per function -> call graph
|
|
152
|
+
-> behavior spec (path conditions -> returns/raises)
|
|
153
|
+
-> nullability data-flow (merges None facts at every branch join; interprocedural)
|
|
154
|
+
-> findings | explain (traceback -> the above, focused on one failure)
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
The nullability pass is a forward fixpoint over the CFG — it merges
|
|
158
|
+
facts at branch joins, so it covers 100% of a function regardless of how
|
|
159
|
+
branchy it is, in roughly linear time.
|
|
160
|
+
|
|
161
|
+
`scan` and `explain` only **read** your code — never import or run it.
|
|
162
|
+
|
|
163
|
+
## Develop
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
pip install -e ".[dev]"
|
|
167
|
+
pytest
|
|
168
|
+
ruff check src
|
|
169
|
+
```
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: deploy-guard-engine
|
|
3
|
-
Version: 0.1.2
|
|
4
|
-
Summary: Static root-cause analysis for a Python stack trace - offline, no account. Plus a deployment-gate scanner.
|
|
5
|
-
Author: sai55387
|
|
6
|
-
License: MIT
|
|
7
|
-
Project-URL: Homepage, https://github.com/Dineshsai7/deploy-guard-engine
|
|
8
|
-
Project-URL: Issues, https://github.com/Dineshsai7/deploy-guard-engine/issues
|
|
9
|
-
Project-URL: Changelog, https://github.com/Dineshsai7/deploy-guard-engine/blob/main/CHANGELOG.md
|
|
10
|
-
Keywords: traceback,stacktrace,root-cause,debugging,static-analysis,control-flow,nullability,deployment,ci,incident
|
|
11
|
-
Classifier: Development Status :: 3 - Alpha
|
|
12
|
-
Classifier: Environment :: Console
|
|
13
|
-
Classifier: Intended Audience :: Developers
|
|
14
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
-
Classifier: Operating System :: OS Independent
|
|
16
|
-
Classifier: Programming Language :: Python :: 3
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
-
Classifier: Topic :: Software Development :: Debuggers
|
|
22
|
-
Classifier: Topic :: Software Development :: Quality Assurance
|
|
23
|
-
Classifier: Topic :: Software Development :: Testing
|
|
24
|
-
Requires-Python: >=3.10
|
|
25
|
-
Description-Content-Type: text/markdown
|
|
26
|
-
License-File: LICENSE
|
|
27
|
-
Provides-Extra: dev
|
|
28
|
-
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
29
|
-
Requires-Dist: pytest-cov; extra == "dev"
|
|
30
|
-
Requires-Dist: ruff; extra == "dev"
|
|
31
|
-
Requires-Dist: build; extra == "dev"
|
|
32
|
-
Requires-Dist: twine; extra == "dev"
|
|
33
|
-
Dynamic: license-file
|
|
34
|
-
|
|
35
|
-
# deploy-guard-engine
|
|
36
|
-
|
|
37
|
-
This published build of deploy-guard-engine is a placeholder - it reserves the package name but contains no analysis logic. The working tool is distributed privately; contact the maintainer for access.
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: deploy-guard-engine
|
|
3
|
-
Version: 0.1.2
|
|
4
|
-
Summary: Static root-cause analysis for a Python stack trace - offline, no account. Plus a deployment-gate scanner.
|
|
5
|
-
Author: sai55387
|
|
6
|
-
License: MIT
|
|
7
|
-
Project-URL: Homepage, https://github.com/Dineshsai7/deploy-guard-engine
|
|
8
|
-
Project-URL: Issues, https://github.com/Dineshsai7/deploy-guard-engine/issues
|
|
9
|
-
Project-URL: Changelog, https://github.com/Dineshsai7/deploy-guard-engine/blob/main/CHANGELOG.md
|
|
10
|
-
Keywords: traceback,stacktrace,root-cause,debugging,static-analysis,control-flow,nullability,deployment,ci,incident
|
|
11
|
-
Classifier: Development Status :: 3 - Alpha
|
|
12
|
-
Classifier: Environment :: Console
|
|
13
|
-
Classifier: Intended Audience :: Developers
|
|
14
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
-
Classifier: Operating System :: OS Independent
|
|
16
|
-
Classifier: Programming Language :: Python :: 3
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
-
Classifier: Topic :: Software Development :: Debuggers
|
|
22
|
-
Classifier: Topic :: Software Development :: Quality Assurance
|
|
23
|
-
Classifier: Topic :: Software Development :: Testing
|
|
24
|
-
Requires-Python: >=3.10
|
|
25
|
-
Description-Content-Type: text/markdown
|
|
26
|
-
License-File: LICENSE
|
|
27
|
-
Provides-Extra: dev
|
|
28
|
-
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
29
|
-
Requires-Dist: pytest-cov; extra == "dev"
|
|
30
|
-
Requires-Dist: ruff; extra == "dev"
|
|
31
|
-
Requires-Dist: build; extra == "dev"
|
|
32
|
-
Requires-Dist: twine; extra == "dev"
|
|
33
|
-
Dynamic: license-file
|
|
34
|
-
|
|
35
|
-
# deploy-guard-engine
|
|
36
|
-
|
|
37
|
-
This published build of deploy-guard-engine is a placeholder - it reserves the package name but contains no analysis logic. The working tool is distributed privately; contact the maintainer for access.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/analysis/__init__.py
RENAMED
|
File without changes
|
{deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/analysis/callgraph.py
RENAMED
|
File without changes
|
{deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/analysis/context.py
RENAMED
|
File without changes
|
{deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/analysis/findings.py
RENAMED
|
File without changes
|
{deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/analysis/nullability.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/explain/__init__.py
RENAMED
|
File without changes
|
{deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/explain/explainer.py
RENAMED
|
File without changes
|
|
File without changes
|
{deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/explain/traceback_parse.py
RENAMED
|
File without changes
|
{deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/frontend/__init__.py
RENAMED
|
File without changes
|
{deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/frontend/python_cfg.py
RENAMED
|
File without changes
|
{deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/frontend/python_frontend.py
RENAMED
|
File without changes
|
{deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/generators/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard/generators/import_smoke.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{deploy_guard_engine-0.1.2 → deploy_guard_engine-0.1.3}/src/deploy_guard_engine.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|