certora-prover-cli 0.2.1__tar.gz → 0.2.2__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.
Files changed (28) hide show
  1. {certora_prover_cli-0.2.1 → certora_prover_cli-0.2.2}/PKG-INFO +1 -1
  2. {certora_prover_cli-0.2.1 → certora_prover_cli-0.2.2}/src/prover_output_utility/_version.py +2 -2
  3. {certora_prover_cli-0.2.1 → certora_prover_cli-0.2.2}/src/prover_output_utility/api/main.py +46 -1
  4. {certora_prover_cli-0.2.1 → certora_prover_cli-0.2.2}/.gitignore +0 -0
  5. {certora_prover_cli-0.2.1 → certora_prover_cli-0.2.2}/LICENSE +0 -0
  6. {certora_prover_cli-0.2.1 → certora_prover_cli-0.2.2}/README.md +0 -0
  7. {certora_prover_cli-0.2.1 → certora_prover_cli-0.2.2}/pyproject.toml +0 -0
  8. {certora_prover_cli-0.2.1 → certora_prover_cli-0.2.2}/src/prover_output_utility/__init__.py +0 -0
  9. {certora_prover_cli-0.2.1 → certora_prover_cli-0.2.2}/src/prover_output_utility/api/__init__.py +0 -0
  10. {certora_prover_cli-0.2.1 → certora_prover_cli-0.2.2}/src/prover_output_utility/api/aws_data_fetcher.py +0 -0
  11. {certora_prover_cli-0.2.1 → certora_prover_cli-0.2.2}/src/prover_output_utility/api/base_data_fetcher.py +0 -0
  12. {certora_prover_cli-0.2.1 → certora_prover_cli-0.2.2}/src/prover_output_utility/api/cache.py +0 -0
  13. {certora_prover_cli-0.2.1 → certora_prover_cli-0.2.2}/src/prover_output_utility/api/data_fetcher.py +0 -0
  14. {certora_prover_cli-0.2.1 → certora_prover_cli-0.2.2}/src/prover_output_utility/api/local_data_fetcher.py +0 -0
  15. {certora_prover_cli-0.2.1 → certora_prover_cli-0.2.2}/src/prover_output_utility/api/tree_parser.py +0 -0
  16. {certora_prover_cli-0.2.1 → certora_prover_cli-0.2.2}/src/prover_output_utility/api/url_utils.py +0 -0
  17. {certora_prover_cli-0.2.1 → certora_prover_cli-0.2.2}/src/prover_output_utility/auth.py +0 -0
  18. {certora_prover_cli-0.2.1 → certora_prover_cli-0.2.2}/src/prover_output_utility/aws_auth.py +0 -0
  19. {certora_prover_cli-0.2.1 → certora_prover_cli-0.2.2}/src/prover_output_utility/breadcrumb.py +0 -0
  20. {certora_prover_cli-0.2.1 → certora_prover_cli-0.2.2}/src/prover_output_utility/exceptions.py +0 -0
  21. {certora_prover_cli-0.2.1 → certora_prover_cli-0.2.2}/src/prover_output_utility/group_summary.py +0 -0
  22. {certora_prover_cli-0.2.1 → certora_prover_cli-0.2.2}/src/prover_output_utility/job_report.py +0 -0
  23. {certora_prover_cli-0.2.1 → certora_prover_cli-0.2.2}/src/prover_output_utility/models.py +0 -0
  24. {certora_prover_cli-0.2.1 → certora_prover_cli-0.2.2}/src/prover_output_utility/parsers.py +0 -0
  25. {certora_prover_cli-0.2.1 → certora_prover_cli-0.2.2}/src/prover_output_utility/prover_api.py +0 -0
  26. {certora_prover_cli-0.2.1 → certora_prover_cli-0.2.2}/src/prover_output_utility/prover_cli.py +0 -0
  27. {certora_prover_cli-0.2.1 → certora_prover_cli-0.2.2}/src/prover_output_utility/py.typed +0 -0
  28. {certora_prover_cli-0.2.1 → certora_prover_cli-0.2.2}/src/prover_output_utility/sighash.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: certora-prover-cli
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: A Python API and CLI for parsing outputs from the Certora Prover
5
5
  Project-URL: Homepage, https://github.com/Certora/ProverCLI
6
6
  Project-URL: Repository, https://github.com/Certora/ProverCLI
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '0.2.1'
22
- __version_tuple__ = version_tuple = (0, 2, 1)
21
+ __version__ = version = '0.2.2'
22
+ __version_tuple__ = version_tuple = (0, 2, 2)
23
23
 
24
24
  __commit_id__ = commit_id = None
@@ -18,6 +18,8 @@ from pathlib import Path
18
18
  from typing import Any, Dict, List, Optional
19
19
 
20
20
  import requests
21
+ from requests.adapters import HTTPAdapter
22
+ from urllib3.util.retry import Retry
21
23
 
22
24
  from ..auth import ProverAuth
23
25
  from ..aws_auth import AWSAuth
@@ -45,6 +47,49 @@ from .tree_parser import TreeParser
45
47
  from .url_utils import extract_job_id, extract_job_identifier
46
48
 
47
49
 
50
+ #: Seconds a request may go without progress before it is abandoned. requests measures this per
51
+ #: socket read rather than over the whole call, so a large download that keeps streaming is
52
+ #: unaffected; it fires when the peer goes quiet. The headroom over the SigV4 fetcher's 30 is for
53
+ #: the outputs archive, where the server has a lot to assemble before the first byte arrives.
54
+ _REQUEST_TIMEOUT_S = 60
55
+
56
+ #: A silent peer that resets or 5xx's mid-transfer is transient — the same request usually succeeds
57
+ #: moments later. Retry it with exponential backoff (``backoff_factor`` doubles the wait each attempt:
58
+ #: ~0.5s, 1s, 2s), capped at a few attempts so an unrecoverable endpoint still fails promptly rather
59
+ #: than looping. Only the default idempotent methods are retried (urllib3 excludes POST), so a retry
60
+ #: never re-runs a non-idempotent call.
61
+ _MAX_RETRIES = 3
62
+ _BACKOFF_FACTOR = 0.5
63
+
64
+
65
+ class _TimedSession(requests.Session):
66
+ """A session whose requests give up on a silent peer and retry a transient failure.
67
+
68
+ requests applies no timeout of its own, so an unresponsive endpoint holds its caller for as
69
+ long as the socket stays open, and a caller that handed the call to a thread cannot get that
70
+ thread back. Every ``get``/``post`` on a session goes through ``request``, so the timeout default
71
+ belongs here rather than at each call site. A caller that passes its own timeout keeps it. The
72
+ mounted adapter additionally retries transient connection/read failures and 502/503/504 with
73
+ exponential backoff.
74
+ """
75
+
76
+ def __init__(self) -> None:
77
+ super().__init__()
78
+ retry = Retry(
79
+ total=_MAX_RETRIES,
80
+ backoff_factor=_BACKOFF_FACTOR,
81
+ status_forcelist=(502, 503, 504),
82
+ raise_on_status=False, # leave status-code handling to the callers
83
+ )
84
+ adapter = HTTPAdapter(max_retries=retry)
85
+ self.mount("https://", adapter)
86
+ self.mount("http://", adapter)
87
+
88
+ def request(self, *args, **kwargs) -> requests.Response:
89
+ kwargs.setdefault("timeout", _REQUEST_TIMEOUT_S)
90
+ return super().request(*args, **kwargs)
91
+
92
+
48
93
  # Per-job locks for thread-safe fetch operations
49
94
  _fetch_locks: dict[str, threading.Lock] = {}
50
95
  _fetch_locks_lock = threading.Lock()
@@ -158,7 +203,7 @@ class ProverOutputAPI:
158
203
 
159
204
  def _setup_session(self, force_relogin: bool = False):
160
205
  """Setup session with authentication cookies."""
161
- self.session = requests.Session()
206
+ self.session = _TimedSession()
162
207
  # Set up authentication
163
208
  self.session.cookies = self.auth.get_auth_cookies(force_relogin=force_relogin)
164
209
  self.data_fetcher = DataFetcher(self.session, api_instance=self, api_base_url=self.api_base_url)