certora-prover-cli 0.2.3__tar.gz → 0.2.5__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.3 → certora_prover_cli-0.2.5}/PKG-INFO +1 -1
  2. {certora_prover_cli-0.2.3 → certora_prover_cli-0.2.5}/src/prover_output_utility/_version.py +2 -2
  3. {certora_prover_cli-0.2.3 → certora_prover_cli-0.2.5}/src/prover_output_utility/api/url_utils.py +27 -0
  4. {certora_prover_cli-0.2.3 → certora_prover_cli-0.2.5}/src/prover_output_utility/auth.py +9 -17
  5. {certora_prover_cli-0.2.3 → certora_prover_cli-0.2.5}/.gitignore +0 -0
  6. {certora_prover_cli-0.2.3 → certora_prover_cli-0.2.5}/LICENSE +0 -0
  7. {certora_prover_cli-0.2.3 → certora_prover_cli-0.2.5}/README.md +0 -0
  8. {certora_prover_cli-0.2.3 → certora_prover_cli-0.2.5}/pyproject.toml +0 -0
  9. {certora_prover_cli-0.2.3 → certora_prover_cli-0.2.5}/src/prover_output_utility/__init__.py +0 -0
  10. {certora_prover_cli-0.2.3 → certora_prover_cli-0.2.5}/src/prover_output_utility/api/__init__.py +0 -0
  11. {certora_prover_cli-0.2.3 → certora_prover_cli-0.2.5}/src/prover_output_utility/api/aws_data_fetcher.py +0 -0
  12. {certora_prover_cli-0.2.3 → certora_prover_cli-0.2.5}/src/prover_output_utility/api/base_data_fetcher.py +0 -0
  13. {certora_prover_cli-0.2.3 → certora_prover_cli-0.2.5}/src/prover_output_utility/api/cache.py +0 -0
  14. {certora_prover_cli-0.2.3 → certora_prover_cli-0.2.5}/src/prover_output_utility/api/data_fetcher.py +0 -0
  15. {certora_prover_cli-0.2.3 → certora_prover_cli-0.2.5}/src/prover_output_utility/api/local_data_fetcher.py +0 -0
  16. {certora_prover_cli-0.2.3 → certora_prover_cli-0.2.5}/src/prover_output_utility/api/main.py +0 -0
  17. {certora_prover_cli-0.2.3 → certora_prover_cli-0.2.5}/src/prover_output_utility/api/tree_parser.py +0 -0
  18. {certora_prover_cli-0.2.3 → certora_prover_cli-0.2.5}/src/prover_output_utility/aws_auth.py +0 -0
  19. {certora_prover_cli-0.2.3 → certora_prover_cli-0.2.5}/src/prover_output_utility/breadcrumb.py +0 -0
  20. {certora_prover_cli-0.2.3 → certora_prover_cli-0.2.5}/src/prover_output_utility/exceptions.py +0 -0
  21. {certora_prover_cli-0.2.3 → certora_prover_cli-0.2.5}/src/prover_output_utility/group_summary.py +0 -0
  22. {certora_prover_cli-0.2.3 → certora_prover_cli-0.2.5}/src/prover_output_utility/job_report.py +0 -0
  23. {certora_prover_cli-0.2.3 → certora_prover_cli-0.2.5}/src/prover_output_utility/models.py +0 -0
  24. {certora_prover_cli-0.2.3 → certora_prover_cli-0.2.5}/src/prover_output_utility/parsers.py +0 -0
  25. {certora_prover_cli-0.2.3 → certora_prover_cli-0.2.5}/src/prover_output_utility/prover_api.py +0 -0
  26. {certora_prover_cli-0.2.3 → certora_prover_cli-0.2.5}/src/prover_output_utility/prover_cli.py +0 -0
  27. {certora_prover_cli-0.2.3 → certora_prover_cli-0.2.5}/src/prover_output_utility/py.typed +0 -0
  28. {certora_prover_cli-0.2.3 → certora_prover_cli-0.2.5}/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.3
3
+ Version: 0.2.5
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.3'
22
- __version_tuple__ = version_tuple = (0, 2, 3)
21
+ __version__ = version = '0.2.5'
22
+ __version_tuple__ = version_tuple = (0, 2, 5)
23
23
 
24
24
  __commit_id__ = commit_id = None
@@ -8,12 +8,26 @@ URL and job ID extraction utilities.
8
8
 
9
9
  import os
10
10
  import re
11
+ import uuid
11
12
  from typing import Optional
12
13
  from urllib.parse import parse_qs, urlparse
13
14
 
14
15
  from ..exceptions import ProverAPIError
15
16
 
16
17
 
18
+ def _job_id_from_uuid(value: str) -> Optional[str]:
19
+ """The job id behind a UUID spelling of it, or None for anything else.
20
+
21
+ A job id is 32 hex characters, and an app link writes it with dashes.
22
+ ``uuid.UUID`` accepts either spelling and rejects everything else, so it
23
+ both validates the value and normalizes it.
24
+ """
25
+ try:
26
+ return uuid.UUID(value).hex
27
+ except ValueError:
28
+ return None
29
+
30
+
17
31
  def extract_job_id(job_input: str) -> str:
18
32
  """
19
33
  Extract job ID from either a URL or direct job ID.
@@ -33,6 +47,10 @@ def extract_job_id(job_input: str) -> str:
33
47
  # Otherwise assume it's a direct job ID
34
48
  # Strip query params if present (e.g., hash?anonymousKey=...)
35
49
  clean = job_input.split("?")[0]
50
+ # An app link writes the same id as a UUID; the API takes it without dashes.
51
+ hex_id = _job_id_from_uuid(clean)
52
+ if hex_id is not None:
53
+ return hex_id
36
54
  if re.match(r"^[a-zA-Z0-9_-]+$", clean):
37
55
  return clean
38
56
 
@@ -112,6 +130,15 @@ def extract_job_id_from_url(url: str) -> str:
112
130
  elif idx + 1 < len(path_parts):
113
131
  return path_parts[idx + 1]
114
132
 
133
+ # An app link names a job as /orgs/<slug>/jobs/<uuid>, with an optional
134
+ # /report after it. The slug is irrelevant, so it is dropped.
135
+ if "jobs" in path_parts:
136
+ idx = path_parts.index("jobs")
137
+ if idx + 1 < len(path_parts):
138
+ hex_id = _job_id_from_uuid(path_parts[idx + 1])
139
+ if hex_id is not None:
140
+ return hex_id
141
+
115
142
  if "job" in path_parts:
116
143
  idx = path_parts.index("job")
117
144
  if idx + 1 < len(path_parts):
@@ -83,28 +83,20 @@ except ImportError:
83
83
  SERVERS = None
84
84
 
85
85
 
86
- # Environment variables holding an organization API key, in the order they are
87
- # consulted. The env-scoped name comes first so a machine configured for one
88
- # environment cannot be pointed at another by a stray generic value.
89
- _API_KEY_ENV_VARS: Dict[LoginEnv, tuple[str, ...]] = {
90
- "prod": ("CERTORA_API_KEY_PROD", "CERTORA_API_KEY"),
91
- "stg": ("CERTORA_API_KEY_STG", "CERTORA_API_KEY"),
92
- "dev": ("CERTORA_API_KEY_DEV", "CERTORA_API_KEY"),
93
- }
86
+ #: The environment variable holding the Certora key, the one certora-cli reads,
87
+ #: so one value serves submitting a job and reading its results.
88
+ KEY_ENV_VAR = "CERTORAKEY"
94
89
 
95
90
 
96
91
  def organization_api_key() -> str | None:
97
- """The organization API key for the current login env, if one is set.
92
+ """The organization API key, if one is set.
98
93
 
99
- This is the key issued on the organization's API page, not ``CERTORAKEY``.
100
- The API accepts it on the ``Authorization`` header and exchanges it for a
101
- short-lived token itself, so a caller that has one needs no browser login.
94
+ This is the key issued on the organization's API page, the same one
95
+ certora-cli submits jobs with. The API accepts it on the ``Authorization``
96
+ header and exchanges it for a short-lived token itself, so a caller that
97
+ has one needs no browser login.
102
98
  """
103
- for name in _API_KEY_ENV_VARS[resolve_login_env()]:
104
- value = (os.environ.get(name) or "").strip()
105
- if value:
106
- return value
107
- return None
99
+ return (os.environ.get(KEY_ENV_VAR) or "").strip() or None
108
100
 
109
101
 
110
102
  class ProverAuth: