certora-prover-cli 0.1.0__py3-none-any.whl
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.
- certora_prover_cli-0.1.0.dist-info/METADATA +293 -0
- certora_prover_cli-0.1.0.dist-info/RECORD +28 -0
- certora_prover_cli-0.1.0.dist-info/WHEEL +4 -0
- certora_prover_cli-0.1.0.dist-info/entry_points.txt +3 -0
- certora_prover_cli-0.1.0.dist-info/licenses/LICENSE +674 -0
- prover_output_utility/__init__.py +42 -0
- prover_output_utility/_version.py +24 -0
- prover_output_utility/api/__init__.py +14 -0
- prover_output_utility/api/aws_data_fetcher.py +485 -0
- prover_output_utility/api/base_data_fetcher.py +176 -0
- prover_output_utility/api/cache.py +149 -0
- prover_output_utility/api/data_fetcher.py +628 -0
- prover_output_utility/api/local_data_fetcher.py +302 -0
- prover_output_utility/api/main.py +1333 -0
- prover_output_utility/api/tree_parser.py +420 -0
- prover_output_utility/api/url_utils.py +125 -0
- prover_output_utility/auth.py +172 -0
- prover_output_utility/aws_auth.py +124 -0
- prover_output_utility/breadcrumb.py +358 -0
- prover_output_utility/exceptions.py +43 -0
- prover_output_utility/group_summary.py +335 -0
- prover_output_utility/job_report.py +115 -0
- prover_output_utility/models.py +689 -0
- prover_output_utility/parsers.py +212 -0
- prover_output_utility/prover_api.py +37 -0
- prover_output_utility/prover_cli.py +682 -0
- prover_output_utility/py.typed +0 -0
- prover_output_utility/sighash.py +345 -0
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: certora-prover-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A Python API and CLI for parsing outputs from the Certora Prover
|
|
5
|
+
Project-URL: Homepage, https://github.com/Certora/ProverCLI
|
|
6
|
+
Project-URL: Repository, https://github.com/Certora/ProverCLI
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/Certora/ProverCLI/issues
|
|
8
|
+
Author-email: Certora <support@certora.com>
|
|
9
|
+
Maintainer-email: Certora <support@certora.com>
|
|
10
|
+
License-Expression: GPL-3.0-only
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Requires-Python: <3.15,>=3.12
|
|
18
|
+
Requires-Dist: boto3>=1.26.0
|
|
19
|
+
Requires-Dist: certora-cloud>=0.1.0
|
|
20
|
+
Requires-Dist: pycryptodome>=3.0
|
|
21
|
+
Requires-Dist: requests>=2.28.0
|
|
22
|
+
Requires-Dist: urllib3>=1.26.0
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Requires-Dist: build>=1.0; extra == 'dev'
|
|
25
|
+
Requires-Dist: reuse>=5.0; extra == 'dev'
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# ProverCLI
|
|
29
|
+
|
|
30
|
+
[](https://github.com/Certora/ProverCLI/actions)
|
|
31
|
+
[](https://www.python.org/downloads/)
|
|
32
|
+
[](https://www.gnu.org/licenses/gpl-3.0)
|
|
33
|
+
|
|
34
|
+
A Python API and CLI for parsing outputs from the Certora Prover. This utility provides an easy-to-use interface for fetching and parsing prover verification results using either job URLs or job IDs.
|
|
35
|
+
|
|
36
|
+
> Distributed on PyPI as **`certora-prover-cli`**; the Python import package is **`prover_output_utility`**
|
|
37
|
+
> (e.g. `from prover_output_utility import ProverOutputAPI`).
|
|
38
|
+
|
|
39
|
+
## Documentation
|
|
40
|
+
|
|
41
|
+
📖 Full Sphinx documentation lives in [`docs/`](docs/) — build it locally with `make -C docs html`
|
|
42
|
+
(see [`docs/README.md`](docs/README.md)).
|
|
43
|
+
|
|
44
|
+
The documentation includes:
|
|
45
|
+
- Complete API reference with all methods and classes
|
|
46
|
+
- Quick start guide and tutorials
|
|
47
|
+
- Usage examples and best practices
|
|
48
|
+
- CLI reference
|
|
49
|
+
- Authentication setup
|
|
50
|
+
- Caching documentation
|
|
51
|
+
|
|
52
|
+
## Features
|
|
53
|
+
|
|
54
|
+
- **Flexible Input**: Accepts job URLs (format: `/output/user_id/job_id`), job IDs, and local `emv-*` folders
|
|
55
|
+
- **Authentication**: Interactive cookie-based login via `certora_login`; AWS SigV4 in CI; no auth for local folders
|
|
56
|
+
- **Comprehensive Parsing**: Extracts job info, verification results, rule details, calltraces, breadcrumbs, and statistics
|
|
57
|
+
- **Error Handling**: Robust error handling with custom exceptions
|
|
58
|
+
- **Type Safety**: Full type hints and typed dataclass results
|
|
59
|
+
|
|
60
|
+
## Installation
|
|
61
|
+
|
|
62
|
+
### As a CLI tool (recommended for end users)
|
|
63
|
+
|
|
64
|
+
Install via [uv](https://docs.astral.sh/uv/) — each tool gets its own isolated venv, with one-command upgrade and uninstall:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# One-time uv install (skip if already installed)
|
|
68
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
69
|
+
|
|
70
|
+
# Install from PyPI
|
|
71
|
+
uv tool install certora-prover-cli
|
|
72
|
+
|
|
73
|
+
# Upgrade / uninstall
|
|
74
|
+
uv tool upgrade certora-prover-cli
|
|
75
|
+
uv tool uninstall certora-prover-cli
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Or with pip: `pip install certora-prover-cli`.
|
|
79
|
+
|
|
80
|
+
### Local development install
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
git clone https://github.com/Certora/ProverCLI.git
|
|
84
|
+
cd ProverCLI
|
|
85
|
+
pip install -e .
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### As a dependency in another Python project
|
|
89
|
+
|
|
90
|
+
```toml
|
|
91
|
+
# pyproject.toml
|
|
92
|
+
dependencies = [
|
|
93
|
+
"certora-prover-cli",
|
|
94
|
+
]
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# requirements.txt
|
|
99
|
+
certora-prover-cli
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Quick Start
|
|
103
|
+
|
|
104
|
+
### Command Line Interface
|
|
105
|
+
|
|
106
|
+
After installation, you can use the `prover-cli` command:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# Get violated rules from a job (using job_id, not user_id)
|
|
110
|
+
prover-cli --job-id 67890
|
|
111
|
+
prover-cli --job-url "https://prover.certora.com/output/12345/67890/..."
|
|
112
|
+
|
|
113
|
+
# Save output to a file
|
|
114
|
+
prover-cli --job-id 67890 --output violations.json
|
|
115
|
+
|
|
116
|
+
# Get only job status
|
|
117
|
+
prover-cli --job-id 67890 --status-only
|
|
118
|
+
|
|
119
|
+
# Output as JSON
|
|
120
|
+
prover-cli --job-id 67890 --format json
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Using as a Python Package
|
|
124
|
+
|
|
125
|
+
Data-fetching methods return typed dataclasses (see [`models.py`](src/prover_output_utility/models.py)),
|
|
126
|
+
so results are accessed by attribute, not dict keys:
|
|
127
|
+
|
|
128
|
+
```python
|
|
129
|
+
from prover_output_utility import ProverOutputAPI
|
|
130
|
+
|
|
131
|
+
# Initialize the API (interactive cookie-based auth via certora_login)
|
|
132
|
+
api = ProverOutputAPI()
|
|
133
|
+
|
|
134
|
+
# Accepts a job URL (format: /output/user_id/job_id), a job ID, or a local emv-* path
|
|
135
|
+
violations = api.get_violated_rules("67890")
|
|
136
|
+
for v in violations: # each v is a CheckResult
|
|
137
|
+
print(f"{v.rule_name} ({v.method_name}): {v.assert_message}")
|
|
138
|
+
if v.source_location:
|
|
139
|
+
print(f" at {v.source_location}") # file:line
|
|
140
|
+
|
|
141
|
+
# Job status without fetching full output
|
|
142
|
+
status = api.get_job_status("67890") # JobStatus enum
|
|
143
|
+
print(f"Job status: {status}")
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Integration Example
|
|
147
|
+
|
|
148
|
+
```python
|
|
149
|
+
from prover_output_utility import ProverOutputAPI
|
|
150
|
+
from prover_output_utility.exceptions import ProverAPIError
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
class VerificationAnalyzer:
|
|
154
|
+
def __init__(self):
|
|
155
|
+
self.api = ProverOutputAPI()
|
|
156
|
+
|
|
157
|
+
def analyze_job(self, job_input):
|
|
158
|
+
try:
|
|
159
|
+
all_checks = self.api.get_all_checks(job_input)
|
|
160
|
+
violations = [c for c in all_checks if c.is_violated]
|
|
161
|
+
if violations:
|
|
162
|
+
return {
|
|
163
|
+
"status": "failed",
|
|
164
|
+
"summary": f"{len(violations)}/{len(all_checks)} checks failed",
|
|
165
|
+
"violations": violations,
|
|
166
|
+
}
|
|
167
|
+
return {"status": "passed", "summary": f"All {len(all_checks)} checks passed"}
|
|
168
|
+
except ProverAPIError as e:
|
|
169
|
+
return {"status": "error", "error": str(e)}
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
result = VerificationAnalyzer().analyze_job("67890") # job_id, not user_id
|
|
173
|
+
print(result)
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Advanced Usage
|
|
177
|
+
|
|
178
|
+
```python
|
|
179
|
+
# List recent jobs (returns JobInfo objects)
|
|
180
|
+
for job in api.list_recent_jobs(limit=5):
|
|
181
|
+
print(f"Job {job.job_id}: {job.status} ({job.start_time})")
|
|
182
|
+
|
|
183
|
+
# Deep trace analysis for a violation
|
|
184
|
+
for v in api.get_violated_rules("67890"):
|
|
185
|
+
if v.has_calltrace:
|
|
186
|
+
trace = api.get_calltrace_for_violation("67890", v)
|
|
187
|
+
print(f"{v.rule_name}: {trace.frame_count} calltrace frames")
|
|
188
|
+
if v.has_breadcrumbs:
|
|
189
|
+
bc = api.get_breadcrumbs_for_violation("67890", v)
|
|
190
|
+
print(f"{v.rule_name}: {bc.total_steps} breadcrumb steps")
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Authentication
|
|
194
|
+
|
|
195
|
+
Authentication is selected automatically by environment — see
|
|
196
|
+
[`docs/authentication.rst`](docs/authentication.rst) for details:
|
|
197
|
+
|
|
198
|
+
| Environment | Mechanism |
|
|
199
|
+
|---|---|
|
|
200
|
+
| Interactive (default) | Cookie-based login via `certora_login` (prompts/uses stored credentials) |
|
|
201
|
+
| CI (`CI` env var + AWS creds) | AWS SigV4 via an OIDC role |
|
|
202
|
+
| Local (`use_local=True`) | None — reads local `emv-*` folders |
|
|
203
|
+
|
|
204
|
+
```python
|
|
205
|
+
api = ProverOutputAPI() # interactive / CI (auto-detected)
|
|
206
|
+
api = ProverOutputAPI(use_local=True) # parse local emv-* folders, no auth
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
> The legacy `CERTORAKEY` / `certora_key=` path is deprecated and no longer the
|
|
210
|
+
> recommended way to authenticate.
|
|
211
|
+
|
|
212
|
+
## Output Structure
|
|
213
|
+
|
|
214
|
+
Prefer the typed accessors — `get_violated_rules()`, `get_all_checks()`,
|
|
215
|
+
`get_job_info()`, `get_calltrace()`, `get_breadcrumbs()` — which return the
|
|
216
|
+
dataclasses defined in [`models.py`](src/prover_output_utility/models.py)
|
|
217
|
+
(`CheckResult`, `JobInfo`, `CalltraceInfo`, `BreadcrumbInfo`, …). The full API
|
|
218
|
+
reference is in [`docs/`](docs/). The lower-level `fetch_output()` returns the
|
|
219
|
+
raw parsed dictionary for backward compatibility.
|
|
220
|
+
|
|
221
|
+
## Error Handling
|
|
222
|
+
|
|
223
|
+
The API provides several custom exceptions:
|
|
224
|
+
|
|
225
|
+
- `ProverAPIError`: Base exception for API errors
|
|
226
|
+
- `AuthenticationError`: Authentication failed
|
|
227
|
+
- `JobNotFoundError`: Job not found or inaccessible
|
|
228
|
+
- `ParseError`: Failed to parse output
|
|
229
|
+
- `InvalidJobError`: Invalid job input format
|
|
230
|
+
- `APITimeoutError`: API request timed out
|
|
231
|
+
|
|
232
|
+
```python
|
|
233
|
+
from prover_output_utility import ProverOutputAPI
|
|
234
|
+
from prover_output_utility.exceptions import JobNotFoundError, AuthenticationError
|
|
235
|
+
|
|
236
|
+
api = ProverOutputAPI()
|
|
237
|
+
|
|
238
|
+
try:
|
|
239
|
+
result = api.fetch_output("invalid-job-id")
|
|
240
|
+
except JobNotFoundError:
|
|
241
|
+
print("Job not found")
|
|
242
|
+
except AuthenticationError:
|
|
243
|
+
print("Authentication failed - check your certora_login session")
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
## Development
|
|
247
|
+
|
|
248
|
+
This repository holds the library/CLI code.
|
|
249
|
+
|
|
250
|
+
### Code Quality
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
# Install development dependencies
|
|
254
|
+
pip install -e .[dev]
|
|
255
|
+
|
|
256
|
+
# Format code
|
|
257
|
+
black src/
|
|
258
|
+
isort src/
|
|
259
|
+
|
|
260
|
+
# Type-check
|
|
261
|
+
mypy src/prover_output_utility/ --ignore-missing-imports
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### License headers (REUSE)
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
uvx --from "reuse[charset-normalizer]" reuse lint
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### Building Documentation
|
|
271
|
+
|
|
272
|
+
ProverCLI uses Sphinx for generating official documentation:
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
# Install documentation dependencies
|
|
276
|
+
pip install sphinx sphinx-rtd-theme
|
|
277
|
+
|
|
278
|
+
# Build HTML documentation
|
|
279
|
+
make -C docs html
|
|
280
|
+
|
|
281
|
+
# View documentation
|
|
282
|
+
open docs/_build/html/index.html
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
The documentation includes:
|
|
286
|
+
- Complete API reference (auto-generated from docstrings)
|
|
287
|
+
- User guide and tutorials
|
|
288
|
+
- Usage examples
|
|
289
|
+
- Authentication setup
|
|
290
|
+
- CLI reference
|
|
291
|
+
- Caching documentation
|
|
292
|
+
|
|
293
|
+
See [docs/README.md](docs/README.md) for detailed documentation build instructions.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
prover_output_utility/__init__.py,sha256=mtF8m320bgnjSLV62n5DNg_ZPmhiK6_YxFi6xZY0EOw,978
|
|
2
|
+
prover_output_utility/_version.py,sha256=n_5vdJsPNu7wZ57LGuRL585uvll-hiuvZUBWzdG0RQU,520
|
|
3
|
+
prover_output_utility/auth.py,sha256=nEBWEX5ABYYZFx8rnKxCuuz4YQFAu8iq8v7NZwOC9fU,5474
|
|
4
|
+
prover_output_utility/aws_auth.py,sha256=sthqY_W11QGPQfqobC9FPoCUhSDfP8kzxzP0RWwKZIo,3771
|
|
5
|
+
prover_output_utility/breadcrumb.py,sha256=I2-lfH5MXZL6QG8SQZveiNZd-1qXYWNyevXPi_i23Y0,12833
|
|
6
|
+
prover_output_utility/exceptions.py,sha256=c3sneNf6ErowK8XEKT_b1A3aZQWyr9_XV7ZgJF8yrdo,695
|
|
7
|
+
prover_output_utility/group_summary.py,sha256=QEX3kBv5qDQmA6rDujzH2AfM5o4BrocEF4z8i1-eSYc,11629
|
|
8
|
+
prover_output_utility/job_report.py,sha256=T4FrHP-scs8DEUx6InBzQ-NvAxhWP58zq6xv-b2VSV4,4408
|
|
9
|
+
prover_output_utility/models.py,sha256=1afdDHsqVRiBjTL0Z-su2gKci_6pYpHk3pTgs1tcaDY,21285
|
|
10
|
+
prover_output_utility/parsers.py,sha256=i3nrW6wBwAMyFy9JBg4hJW1it6H5V3z66nZdCFrNYwo,6755
|
|
11
|
+
prover_output_utility/prover_api.py,sha256=hokyq00Y6co3dr8NFiS1urpEwbyUoBO3WJG2okqdbz8,738
|
|
12
|
+
prover_output_utility/prover_cli.py,sha256=rHyXZKnOutMeAYPF28QYnRup9qBt6sJrAXz7rvA1gic,27227
|
|
13
|
+
prover_output_utility/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
|
+
prover_output_utility/sighash.py,sha256=sP8gTiXIOBRMj5IcVItaEQdNf-vH2YqoZRLxdaRuqrc,9852
|
|
15
|
+
prover_output_utility/api/__init__.py,sha256=BTP4mN6CjoBW4KcghWlggrIrL0D5auH5dPsCeFPB_XM,291
|
|
16
|
+
prover_output_utility/api/aws_data_fetcher.py,sha256=JKiajIpqkSJQQn4WC_sVokDfo0QTEZ3Cx9PIMPyg7fA,18289
|
|
17
|
+
prover_output_utility/api/base_data_fetcher.py,sha256=AQgB1BkJW1TWRqNgZnMUIuP9K5BfgJ1EOwWeWCREq5c,4582
|
|
18
|
+
prover_output_utility/api/cache.py,sha256=kqtW36OBNdfcRZSEfiaCjoJ26AfZN30cOdczKxWGhkE,5073
|
|
19
|
+
prover_output_utility/api/data_fetcher.py,sha256=-VGWDnJW_t7p8KOdJOIyDAuK3e48gy7mD0GxQ5oRPRQ,23400
|
|
20
|
+
prover_output_utility/api/local_data_fetcher.py,sha256=aXnL3M95UPRKSQYPaPJ_YCwKoBPnC6UndWK7E9c9YSU,10889
|
|
21
|
+
prover_output_utility/api/main.py,sha256=4DzzgSE0nazOAYLMBR1hLkC9Wai4x54UrQRMOCiIxSA,52398
|
|
22
|
+
prover_output_utility/api/tree_parser.py,sha256=tM9HOkqwEUqmcuphWdsGPgq5rAlb0-SvEvjYK6N1ylM,16707
|
|
23
|
+
prover_output_utility/api/url_utils.py,sha256=rIAiEaJX2iCqlMcnuWQbw9SscMwuvkDPXZThBHqVexc,3870
|
|
24
|
+
certora_prover_cli-0.1.0.dist-info/METADATA,sha256=KoNHr8b9xlaw-jvzHxNTaeUyv5sr7dMbCufseDQPC1c,9043
|
|
25
|
+
certora_prover_cli-0.1.0.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
|
|
26
|
+
certora_prover_cli-0.1.0.dist-info/entry_points.txt,sha256=4Yr8Aq3hmZ_Vy9q74JT_NHsjFqhed5c7zrryFFB_R44,133
|
|
27
|
+
certora_prover_cli-0.1.0.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
28
|
+
certora_prover_cli-0.1.0.dist-info/RECORD,,
|