ecosyste-ms-cli 1.5.0__tar.gz → 2.0.0__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.
- ecosyste_ms_cli-2.0.0/CHANGELOG.md +8 -0
- {ecosyste_ms_cli-1.5.0/ecosyste_ms_cli.egg-info → ecosyste_ms_cli-2.0.0}/PKG-INFO +10 -11
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0/ecosyste_ms_cli.egg-info}/PKG-INFO +10 -11
- ecosyste_ms_cli-2.0.0/ecosyste_ms_cli.egg-info/requires.txt +19 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/__init__.py +1 -1
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/apis/advisories.openapi.yaml +1 -1
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/apis/commits.openapi.yaml +2 -2
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/apis/issues.openapi.yaml +2 -2
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/apis/packages.openapi.yaml +68 -4
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/apis/repos.openapi.yaml +2 -2
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/cli.py +3 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/advisories.py +34 -2
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/decorators.py +4 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/diff.py +2 -2
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/execution.py +38 -9
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/generator.py +29 -2
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/licenses.py +2 -2
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/mcp.py +3 -3
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/parser.py +2 -2
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/resolve.py +16 -6
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/sbom.py +2 -2
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/constants.py +1 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/exceptions.py +10 -1
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/helpers/click_params.py +7 -1
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/helpers/get_domain.py +11 -6
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/helpers/job_polling.py +18 -7
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/helpers/print_output.py +74 -12
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/helpers/purl_parser.py +32 -7
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/openapi_client.py +34 -6
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/pyproject.toml +10 -11
- ecosyste_ms_cli-2.0.0/tests/test_cli.py +160 -0
- ecosyste_ms_cli-2.0.0/tests/test_help_output.py +83 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/tests/test_openapi_client.py +83 -6
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/tests/test_print_output.py +103 -0
- ecosyste_ms_cli-1.5.0/CHANGELOG.md +0 -8
- ecosyste_ms_cli-1.5.0/ecosyste_ms_cli.egg-info/requires.txt +0 -22
- ecosyste_ms_cli-1.5.0/tests/test_cli.py +0 -75
- ecosyste_ms_cli-1.5.0/tests/test_help_output.py +0 -40
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/LICENSE +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/MANIFEST.in +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/Readme.md +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosyste_ms_cli.egg-info/SOURCES.txt +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosyste_ms_cli.egg-info/dependency_links.txt +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosyste_ms_cli.egg-info/entry_points.txt +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosyste_ms_cli.egg-info/top_level.txt +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/__main__.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/apis/__init__.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/apis/archives.openapi.yaml +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/apis/dependabot.openapi.yaml +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/apis/diff.openapi.yaml +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/apis/docker.openapi.yaml +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/apis/licenses.openapi.yaml +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/apis/opencollective.openapi.yaml +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/apis/parser.openapi.yaml +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/apis/registries.yaml +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/apis/resolve.openapi.yaml +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/apis/sbom.openapi.yaml +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/apis/sponsors.openapi.yaml +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/apis/summary.openapi.yaml +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/apis/timeline.openapi.yaml +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/__init__.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/archives.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/commits.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/dependabot.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/docker.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/handlers/__init__.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/handlers/advisories.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/handlers/archives.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/handlers/base.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/handlers/commits.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/handlers/default.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/handlers/dependabot.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/handlers/diff.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/handlers/docker.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/handlers/factory.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/handlers/issues.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/handlers/licenses.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/handlers/opencollective.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/handlers/packages.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/handlers/parser.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/handlers/repos.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/handlers/resolve.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/handlers/sbom.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/handlers/sponsors.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/handlers/summary.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/handlers/timeline.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/issues.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/opencollective.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/packages.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/purl_options.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/repos.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/sponsors.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/summary.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/commands/timeline.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/helpers/build_kwargs.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/helpers/flatten_dict.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/helpers/format_value.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/helpers/load_api_spec.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/helpers/print_error.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/helpers/print_operations.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/ecosystems_cli/mcp_server.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/setup.cfg +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/tests/test_cli_domain.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/tests/test_constants.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/tests/test_format_value.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/tests/test_handlers.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/tests/test_load_api_spec.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/tests/test_mcp_server.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/tests/test_package_metadata.py +0 -0
- {ecosyste_ms_cli-1.5.0 → ecosyste_ms_cli-2.0.0}/tests/test_print_operations.py +0 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Changelog for v2.0.0
|
|
2
|
+
|
|
3
|
+
## Changes since v1.6.0
|
|
4
|
+
|
|
5
|
+
- feat!: refresh vendored API specs, track upstream getHosts rename (a1c53a6)
|
|
6
|
+
- ci: bump pinned GitHub Action SHAs to latest releases (e3e9a9b)
|
|
7
|
+
- fix(deps): bump mcp to 1.30 for security advisories, refresh pins (75916bb)
|
|
8
|
+
- chore: bump pre-commit hook revisions (459b34c)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ecosyste_ms_cli
|
|
3
|
-
Version:
|
|
3
|
+
Version: 2.0.0
|
|
4
4
|
Summary: CLI for ecosyste.ms API
|
|
5
5
|
Author-email: Sebastian Schürmann <sebs@2xs.org>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -21,23 +21,22 @@ Classifier: Topic :: Utilities
|
|
|
21
21
|
Requires-Python: >=3.9
|
|
22
22
|
Description-Content-Type: text/markdown
|
|
23
23
|
License-File: LICENSE
|
|
24
|
-
Requires-Dist: click~=8.
|
|
25
|
-
Requires-Dist: requests~=2.
|
|
24
|
+
Requires-Dist: click~=8.5.0
|
|
25
|
+
Requires-Dist: requests~=2.34.2
|
|
26
26
|
Requires-Dist: pyyaml~=6.0.3
|
|
27
27
|
Requires-Dist: rich~=15.0.0
|
|
28
|
-
Requires-Dist: mcp~=1.
|
|
28
|
+
Requires-Dist: mcp~=1.30.0
|
|
29
29
|
Requires-Dist: openapi-core~=0.23.0
|
|
30
30
|
Requires-Dist: packageurl-python~=0.17.6
|
|
31
|
-
Requires-Dist: importlib-resources; python_version < "3.9"
|
|
32
31
|
Provides-Extra: dev
|
|
33
|
-
Requires-Dist: pytest~=9.
|
|
34
|
-
Requires-Dist: pytest-asyncio~=1.
|
|
35
|
-
Requires-Dist: black~=26.
|
|
36
|
-
Requires-Dist: isort~=
|
|
32
|
+
Requires-Dist: pytest~=9.1.1; extra == "dev"
|
|
33
|
+
Requires-Dist: pytest-asyncio~=1.4.0; extra == "dev"
|
|
34
|
+
Requires-Dist: black~=26.5.1; extra == "dev"
|
|
35
|
+
Requires-Dist: isort~=9.0.1; extra == "dev"
|
|
37
36
|
Requires-Dist: flake8~=7.3.0; extra == "dev"
|
|
38
37
|
Requires-Dist: bandit~=1.9.4; extra == "dev"
|
|
39
|
-
Requires-Dist: complexipy~=
|
|
40
|
-
Requires-Dist: tomli~=2.
|
|
38
|
+
Requires-Dist: complexipy~=8.0.1; extra == "dev"
|
|
39
|
+
Requires-Dist: tomli~=2.4.1; python_version < "3.11" and extra == "dev"
|
|
41
40
|
Dynamic: license-file
|
|
42
41
|
|
|
43
42
|
# Ecosystems CLI
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ecosyste_ms_cli
|
|
3
|
-
Version:
|
|
3
|
+
Version: 2.0.0
|
|
4
4
|
Summary: CLI for ecosyste.ms API
|
|
5
5
|
Author-email: Sebastian Schürmann <sebs@2xs.org>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -21,23 +21,22 @@ Classifier: Topic :: Utilities
|
|
|
21
21
|
Requires-Python: >=3.9
|
|
22
22
|
Description-Content-Type: text/markdown
|
|
23
23
|
License-File: LICENSE
|
|
24
|
-
Requires-Dist: click~=8.
|
|
25
|
-
Requires-Dist: requests~=2.
|
|
24
|
+
Requires-Dist: click~=8.5.0
|
|
25
|
+
Requires-Dist: requests~=2.34.2
|
|
26
26
|
Requires-Dist: pyyaml~=6.0.3
|
|
27
27
|
Requires-Dist: rich~=15.0.0
|
|
28
|
-
Requires-Dist: mcp~=1.
|
|
28
|
+
Requires-Dist: mcp~=1.30.0
|
|
29
29
|
Requires-Dist: openapi-core~=0.23.0
|
|
30
30
|
Requires-Dist: packageurl-python~=0.17.6
|
|
31
|
-
Requires-Dist: importlib-resources; python_version < "3.9"
|
|
32
31
|
Provides-Extra: dev
|
|
33
|
-
Requires-Dist: pytest~=9.
|
|
34
|
-
Requires-Dist: pytest-asyncio~=1.
|
|
35
|
-
Requires-Dist: black~=26.
|
|
36
|
-
Requires-Dist: isort~=
|
|
32
|
+
Requires-Dist: pytest~=9.1.1; extra == "dev"
|
|
33
|
+
Requires-Dist: pytest-asyncio~=1.4.0; extra == "dev"
|
|
34
|
+
Requires-Dist: black~=26.5.1; extra == "dev"
|
|
35
|
+
Requires-Dist: isort~=9.0.1; extra == "dev"
|
|
37
36
|
Requires-Dist: flake8~=7.3.0; extra == "dev"
|
|
38
37
|
Requires-Dist: bandit~=1.9.4; extra == "dev"
|
|
39
|
-
Requires-Dist: complexipy~=
|
|
40
|
-
Requires-Dist: tomli~=2.
|
|
38
|
+
Requires-Dist: complexipy~=8.0.1; extra == "dev"
|
|
39
|
+
Requires-Dist: tomli~=2.4.1; python_version < "3.11" and extra == "dev"
|
|
41
40
|
Dynamic: license-file
|
|
42
41
|
|
|
43
42
|
# Ecosystems CLI
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
click~=8.5.0
|
|
2
|
+
requests~=2.34.2
|
|
3
|
+
pyyaml~=6.0.3
|
|
4
|
+
rich~=15.0.0
|
|
5
|
+
mcp~=1.30.0
|
|
6
|
+
openapi-core~=0.23.0
|
|
7
|
+
packageurl-python~=0.17.6
|
|
8
|
+
|
|
9
|
+
[dev]
|
|
10
|
+
pytest~=9.1.1
|
|
11
|
+
pytest-asyncio~=1.4.0
|
|
12
|
+
black~=26.5.1
|
|
13
|
+
isort~=9.0.1
|
|
14
|
+
flake8~=7.3.0
|
|
15
|
+
bandit~=1.9.4
|
|
16
|
+
complexipy~=8.0.1
|
|
17
|
+
|
|
18
|
+
[dev:python_version < "3.11"]
|
|
19
|
+
tomli~=2.4.1
|
|
@@ -201,9 +201,64 @@ paths:
|
|
|
201
201
|
type: array
|
|
202
202
|
items:
|
|
203
203
|
"$ref": "#/components/schemas/PackageWithRegistry"
|
|
204
|
+
"/versions/lookup":
|
|
205
|
+
get:
|
|
206
|
+
summary: lookup versions by integrity hash
|
|
207
|
+
operationId: lookupVersions
|
|
208
|
+
tags:
|
|
209
|
+
- versions
|
|
210
|
+
parameters:
|
|
211
|
+
- name: integrity
|
|
212
|
+
in: query
|
|
213
|
+
description: integrity hash (SRI format)
|
|
214
|
+
required: false
|
|
215
|
+
schema:
|
|
216
|
+
type: string
|
|
217
|
+
- name: sha256
|
|
218
|
+
in: query
|
|
219
|
+
description: sha256 hash (hex)
|
|
220
|
+
required: false
|
|
221
|
+
schema:
|
|
222
|
+
type: string
|
|
223
|
+
- name: sha1
|
|
224
|
+
in: query
|
|
225
|
+
description: sha1 hash (hex)
|
|
226
|
+
required: false
|
|
227
|
+
schema:
|
|
228
|
+
type: string
|
|
229
|
+
- name: sha512
|
|
230
|
+
in: query
|
|
231
|
+
description: sha512 hash (hex)
|
|
232
|
+
required: false
|
|
233
|
+
schema:
|
|
234
|
+
type: string
|
|
235
|
+
- name: page
|
|
236
|
+
in: query
|
|
237
|
+
description: page number
|
|
238
|
+
required: false
|
|
239
|
+
schema:
|
|
240
|
+
type: integer
|
|
241
|
+
- name: per_page
|
|
242
|
+
in: query
|
|
243
|
+
description: Number of records to return
|
|
244
|
+
required: false
|
|
245
|
+
schema:
|
|
246
|
+
type: integer
|
|
247
|
+
responses:
|
|
248
|
+
'200':
|
|
249
|
+
description: successful operation
|
|
250
|
+
content:
|
|
251
|
+
application/json:
|
|
252
|
+
schema:
|
|
253
|
+
type: array
|
|
254
|
+
items:
|
|
255
|
+
"$ref": "#/components/schemas/VersionLookup"
|
|
256
|
+
'400':
|
|
257
|
+
description: missing integrity parameter
|
|
204
258
|
"/packages/lookup":
|
|
205
259
|
get:
|
|
206
|
-
summary: lookup a package by repository URL, purl or ecosystem+name
|
|
260
|
+
summary: lookup a single package by repository URL, purl or ecosystem+name.
|
|
261
|
+
For multiple packages use POST /packages/bulk_lookup.
|
|
207
262
|
operationId: lookupPackage
|
|
208
263
|
tags:
|
|
209
264
|
- packages
|
|
@@ -216,7 +271,7 @@ paths:
|
|
|
216
271
|
type: string
|
|
217
272
|
- name: purl
|
|
218
273
|
in: query
|
|
219
|
-
description: package URL
|
|
274
|
+
description: single package URL. For multiple purls use POST /packages/bulk_lookup.
|
|
220
275
|
required: false
|
|
221
276
|
schema:
|
|
222
277
|
type: string
|
|
@@ -468,7 +523,7 @@ paths:
|
|
|
468
523
|
"$ref": "#/components/schemas/KeywordWithPackages"
|
|
469
524
|
"/registries":
|
|
470
525
|
get:
|
|
471
|
-
summary: list
|
|
526
|
+
summary: list registries
|
|
472
527
|
operationId: getRegistries
|
|
473
528
|
tags:
|
|
474
529
|
- registries
|
|
@@ -553,7 +608,7 @@ paths:
|
|
|
553
608
|
type: string
|
|
554
609
|
- name: purl
|
|
555
610
|
in: query
|
|
556
|
-
description: package URL
|
|
611
|
+
description: single package URL. For multiple purls use POST /packages/bulk_lookup.
|
|
557
612
|
required: false
|
|
558
613
|
schema:
|
|
559
614
|
type: string
|
|
@@ -2098,6 +2153,15 @@ components:
|
|
|
2098
2153
|
type: array
|
|
2099
2154
|
items:
|
|
2100
2155
|
"$ref": "#/components/schemas/Dependency"
|
|
2156
|
+
VersionLookup:
|
|
2157
|
+
allOf:
|
|
2158
|
+
- "$ref": "#/components/schemas/VersionWithDependencies"
|
|
2159
|
+
- type: object
|
|
2160
|
+
required:
|
|
2161
|
+
- package
|
|
2162
|
+
properties:
|
|
2163
|
+
package:
|
|
2164
|
+
"$ref": "#/components/schemas/PackageWithRegistry"
|
|
2101
2165
|
VersionWithPackage:
|
|
2102
2166
|
required:
|
|
2103
2167
|
- id
|
|
@@ -29,9 +29,12 @@ from ecosystems_cli.constants import (
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
@click.group(invoke_without_command=True)
|
|
32
|
+
@click.version_option(__version__, "--version", prog_name="ecosystems")
|
|
32
33
|
@click.option(
|
|
33
34
|
"--timeout",
|
|
34
35
|
default=DEFAULT_TIMEOUT,
|
|
36
|
+
# Same bounds as commands/decorators.py common_options.
|
|
37
|
+
type=click.IntRange(min=1, max=86400),
|
|
35
38
|
help=f"Timeout in seconds for API requests. Default is {DEFAULT_TIMEOUT} seconds.",
|
|
36
39
|
)
|
|
37
40
|
@click.option(
|
|
@@ -19,8 +19,8 @@ advisories = APICommandGenerator.create_api_group("advisories")
|
|
|
19
19
|
@click.option("--package-name", type=str, default=None, help="Package to filter by")
|
|
20
20
|
@click.option("--severity", type=str, default=None, help="Severity to filter by")
|
|
21
21
|
@click.option("--repository-url", type=str, default=None, help="Repository URL to filter by")
|
|
22
|
-
@click.option("--page", type=
|
|
23
|
-
@click.option("--per-page", type=
|
|
22
|
+
@click.option("--page", type=click.IntRange(min=1), default=None, help="pagination page number")
|
|
23
|
+
@click.option("--per-page", type=click.IntRange(min=1), default=None, help="Number of records to return")
|
|
24
24
|
@click.option("--created-after", type=str, default=None, help="filter by created_at after given time")
|
|
25
25
|
@click.option("--updated-after", type=str, default=None, help="filter by updated_at after given time")
|
|
26
26
|
@click.option("--sort", type=str, default=None, help="field to order results by")
|
|
@@ -90,3 +90,35 @@ def get_advisories(
|
|
|
90
90
|
)
|
|
91
91
|
|
|
92
92
|
execute_api_call(ctx, "advisories", operation_id="getAdvisories", call_args=(), call_kwargs=kwargs)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
@override_auto_command(
|
|
96
|
+
advisories,
|
|
97
|
+
"lookup_advisories",
|
|
98
|
+
help="lookup advisories by Package URL (PURL) or repository URL (one of the two is required)",
|
|
99
|
+
)
|
|
100
|
+
@click.option("--purl", type=str, default=None, help="Package URL (PURL). Example: pkg:npm/lodash@4.17.20")
|
|
101
|
+
@click.option("--repository-url", type=str, default=None, help="Source repository URL. Example: https://github.com/rails/rails")
|
|
102
|
+
@common_options
|
|
103
|
+
@click.pass_context
|
|
104
|
+
def lookup_advisories(
|
|
105
|
+
ctx,
|
|
106
|
+
timeout: int,
|
|
107
|
+
format: str,
|
|
108
|
+
domain: Optional[str],
|
|
109
|
+
mailto: Optional[str],
|
|
110
|
+
purl: Optional[str],
|
|
111
|
+
repository_url: Optional[str],
|
|
112
|
+
):
|
|
113
|
+
"""Lookup advisories by PURL or repository URL.
|
|
114
|
+
|
|
115
|
+
The API requires one of purl/repository_url; validate locally so the
|
|
116
|
+
mistake is a usage error instead of a doomed network round-trip.
|
|
117
|
+
"""
|
|
118
|
+
update_context(ctx, timeout, format, domain, mailto)
|
|
119
|
+
|
|
120
|
+
if not purl and not repository_url:
|
|
121
|
+
raise click.UsageError("One of --purl or --repository-url is required.")
|
|
122
|
+
|
|
123
|
+
kwargs = build_kwargs(purl=purl, repository_url=repository_url)
|
|
124
|
+
execute_api_call(ctx, "advisories", operation_id="lookupAdvisories", call_args=(), call_kwargs=kwargs)
|
|
@@ -22,6 +22,10 @@ def common_options(f):
|
|
|
22
22
|
f = click.option(
|
|
23
23
|
"--timeout",
|
|
24
24
|
default=DEFAULT_TIMEOUT,
|
|
25
|
+
# Bounded so nonsensical values fail as usage errors instead of
|
|
26
|
+
# surfacing internals from the HTTP stack (0/negative) or crashing
|
|
27
|
+
# on timestamp conversion (astronomically large).
|
|
28
|
+
type=click.IntRange(min=1, max=86400),
|
|
25
29
|
help=f"Timeout in seconds for API requests. Default is {DEFAULT_TIMEOUT} seconds.",
|
|
26
30
|
)(f)
|
|
27
31
|
f = click.option(
|
|
@@ -18,13 +18,13 @@ diff = APICommandGenerator.create_api_group("diff")
|
|
|
18
18
|
@click.argument("url_2", required=True)
|
|
19
19
|
@click.option(
|
|
20
20
|
"--polling-interval",
|
|
21
|
-
type=
|
|
21
|
+
type=click.FloatRange(min=0.1),
|
|
22
22
|
default=None,
|
|
23
23
|
help="Polling interval in seconds. If set, the command will poll the job status until completion.",
|
|
24
24
|
)
|
|
25
25
|
@click.option(
|
|
26
26
|
"--max-wait",
|
|
27
|
-
type=
|
|
27
|
+
type=click.FloatRange(min=0, min_open=True),
|
|
28
28
|
default=DEFAULT_MAX_POLL_WAIT,
|
|
29
29
|
help=f"Maximum seconds to poll before giving up. Default is {DEFAULT_MAX_POLL_WAIT}.",
|
|
30
30
|
)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"""API execution helpers for ecosystems CLI commands."""
|
|
2
2
|
|
|
3
|
+
import sys
|
|
3
4
|
from typing import Optional
|
|
4
5
|
|
|
5
6
|
from rich.console import Console
|
|
@@ -9,20 +10,43 @@ from ecosystems_cli.constants import DEFAULT_OUTPUT_FORMAT, DEFAULT_TIMEOUT
|
|
|
9
10
|
from ecosystems_cli.exceptions import EcosystemsCLIError
|
|
10
11
|
from ecosystems_cli.helpers.get_domain import build_base_url, get_domain_with_precedence
|
|
11
12
|
from ecosystems_cli.helpers.print_error import print_error
|
|
12
|
-
from ecosystems_cli.helpers.print_output import print_output
|
|
13
|
+
from ecosystems_cli.helpers.print_output import exit_on_broken_pipe, print_output
|
|
13
14
|
from ecosystems_cli.openapi_client import _factory as api_factory
|
|
14
15
|
|
|
15
16
|
console = Console()
|
|
17
|
+
# Diagnostics go to stderr so stdout stays machine-parseable: piping
|
|
18
|
+
# `--format json` output must never receive an error panel as data.
|
|
19
|
+
err_console = Console(stderr=True)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _explicitly_set(ctx, param_name: str, value, default) -> bool:
|
|
23
|
+
"""Whether an option was actually provided at this command level.
|
|
24
|
+
|
|
25
|
+
Click's parameter-source tracking distinguishes an explicit value from the
|
|
26
|
+
option's default even when they are equal -- comparing against the default
|
|
27
|
+
cannot: a leaf-level ``--format table`` (the default value) would look
|
|
28
|
+
unset and lose to an outer ``--format json``. Falls back to the
|
|
29
|
+
value-differs-from-default heuristic for contexts without source tracking
|
|
30
|
+
(e.g. plain mocks in tests).
|
|
31
|
+
"""
|
|
32
|
+
get_source = getattr(ctx, "get_parameter_source", None)
|
|
33
|
+
if get_source is not None:
|
|
34
|
+
source = get_source(param_name)
|
|
35
|
+
if source is not None:
|
|
36
|
+
from click.core import ParameterSource
|
|
37
|
+
|
|
38
|
+
return source != ParameterSource.DEFAULT
|
|
39
|
+
return value != default
|
|
16
40
|
|
|
17
41
|
|
|
18
42
|
def update_context(ctx, timeout: int, format: str, domain: Optional[str], mailto: Optional[str] = None):
|
|
19
43
|
"""Merge command-level options into ``ctx.obj``.
|
|
20
44
|
|
|
21
45
|
The single context-precedence mechanism, used by both the API group callback
|
|
22
|
-
and every leaf command. An option is written only when it
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
46
|
+
and every leaf command. An option is written only when it was explicitly set
|
|
47
|
+
at this level (per Click's parameter source); otherwise the value already in
|
|
48
|
+
``ctx.obj`` -- inherited from the parent context -- is left untouched. The
|
|
49
|
+
net precedence is therefore: leaf option > group option > root option >
|
|
26
50
|
default.
|
|
27
51
|
|
|
28
52
|
Args:
|
|
@@ -33,9 +57,9 @@ def update_context(ctx, timeout: int, format: str, domain: Optional[str], mailto
|
|
|
33
57
|
mailto: Email address for polite pool access
|
|
34
58
|
"""
|
|
35
59
|
ctx.ensure_object(dict)
|
|
36
|
-
if timeout
|
|
60
|
+
if _explicitly_set(ctx, "timeout", timeout, DEFAULT_TIMEOUT):
|
|
37
61
|
ctx.obj["timeout"] = timeout
|
|
38
|
-
if format
|
|
62
|
+
if _explicitly_set(ctx, "format", format, DEFAULT_OUTPUT_FORMAT):
|
|
39
63
|
ctx.obj["format"] = format
|
|
40
64
|
if domain is not None:
|
|
41
65
|
ctx.obj["domain"] = domain
|
|
@@ -109,6 +133,11 @@ def execute_api_call(
|
|
|
109
133
|
|
|
110
134
|
print_output(result, ctx.obj.get("format", DEFAULT_OUTPUT_FORMAT), console=console)
|
|
111
135
|
except EcosystemsCLIError as e:
|
|
112
|
-
print_error(str(e), console=
|
|
136
|
+
print_error(str(e), console=err_console)
|
|
137
|
+
sys.exit(1)
|
|
138
|
+
except BrokenPipeError:
|
|
139
|
+
# The consumer closed the pipe (e.g. `... | head`): not an error.
|
|
140
|
+
exit_on_broken_pipe()
|
|
113
141
|
except Exception as e:
|
|
114
|
-
print_error(f"Unexpected error: {str(e)}", console=
|
|
142
|
+
print_error(f"Unexpected error: {str(e)}", console=err_console)
|
|
143
|
+
sys.exit(1)
|
|
@@ -9,6 +9,25 @@ from ecosystems_cli.commands.decorators import common_options
|
|
|
9
9
|
from ecosystems_cli.helpers.click_params import build_body_decorators, build_click_decorators
|
|
10
10
|
from ecosystems_cli.helpers.load_api_spec import load_api_spec
|
|
11
11
|
|
|
12
|
+
# Help-text overrides for auto-generated commands, keyed by
|
|
13
|
+
# (api_name, operation_id). The OpenAPI specs are vendored verbatim from
|
|
14
|
+
# upstream (and checksummed), so spec typos and missing summaries are
|
|
15
|
+
# corrected here instead of editing the spec files.
|
|
16
|
+
HELP_OVERRIDES = {
|
|
17
|
+
("advisories", "getAdvisory"): "get an advisory by uuid",
|
|
18
|
+
("dependabot", "getRegistries"): "list registries",
|
|
19
|
+
("packages", "getRegistries"): "list registries",
|
|
20
|
+
# The opencollective spec has no summary fields at all, so these commands
|
|
21
|
+
# would otherwise fall back to "Execute <operationId>" placeholders.
|
|
22
|
+
("opencollective", "getCollectives"): "list open collective collectives",
|
|
23
|
+
("opencollective", "getCollective"): "get a collective by id",
|
|
24
|
+
("opencollective", "getCollectiveProjects"): "list projects of a collective",
|
|
25
|
+
("opencollective", "getProjects"): "list open source projects with collectives",
|
|
26
|
+
("opencollective", "getProject"): "get a project by id",
|
|
27
|
+
("opencollective", "getProjectPackages"): "list packages of a project",
|
|
28
|
+
("opencollective", "lookupProject"): "lookup a project by repository or package URL",
|
|
29
|
+
}
|
|
30
|
+
|
|
12
31
|
|
|
13
32
|
class APICommandGenerator:
|
|
14
33
|
"""Generate CLI commands from OpenAPI specifications."""
|
|
@@ -61,7 +80,9 @@ class APICommandGenerator:
|
|
|
61
80
|
continue
|
|
62
81
|
|
|
63
82
|
command_name = APICommandGenerator.operation_id_to_command_name(operation_id)
|
|
64
|
-
description =
|
|
83
|
+
description = HELP_OVERRIDES.get((api_name, operation_id)) or operation.get(
|
|
84
|
+
"summary", f"Execute {operation_id}"
|
|
85
|
+
)
|
|
65
86
|
parameters = operation.get("parameters", [])
|
|
66
87
|
request_body = operation.get("requestBody")
|
|
67
88
|
|
|
@@ -109,7 +130,13 @@ class APICommandGenerator:
|
|
|
109
130
|
update_context(ctx, timeout, format, domain, mailto)
|
|
110
131
|
execute_api_call(ctx, api_name, operation_id=op_id, call_args=args, call_kwargs=kwargs, body_keys=body_keys)
|
|
111
132
|
|
|
112
|
-
|
|
133
|
+
# command_impl is already a click.Command here, so each decorator
|
|
134
|
+
# APPENDS its parameter to command.params in application order.
|
|
135
|
+
# Iterating forward therefore preserves the OpenAPI spec order —
|
|
136
|
+
# positional arguments must match the URL path order
|
|
137
|
+
# (/hosts/{host}/... => HOSTNAME first). reversed() here produced
|
|
138
|
+
# REPOSITORYNAME HOSTNAME usage, inverted from the API path.
|
|
139
|
+
for decorator in click_decorators:
|
|
113
140
|
command_impl = decorator(command_impl)
|
|
114
141
|
|
|
115
142
|
return command_impl
|
|
@@ -17,13 +17,13 @@ licenses = APICommandGenerator.create_api_group("licenses")
|
|
|
17
17
|
@click.argument("url", required=True)
|
|
18
18
|
@click.option(
|
|
19
19
|
"--polling-interval",
|
|
20
|
-
type=
|
|
20
|
+
type=click.FloatRange(min=0.1),
|
|
21
21
|
default=None,
|
|
22
22
|
help="Polling interval in seconds. If set, the command will poll the job status until completion.",
|
|
23
23
|
)
|
|
24
24
|
@click.option(
|
|
25
25
|
"--max-wait",
|
|
26
|
-
type=
|
|
26
|
+
type=click.FloatRange(min=0, min_open=True),
|
|
27
27
|
default=DEFAULT_MAX_POLL_WAIT,
|
|
28
28
|
help=f"Maximum seconds to poll before giving up. Default is {DEFAULT_MAX_POLL_WAIT}.",
|
|
29
29
|
)
|
|
@@ -8,13 +8,13 @@ console = Console()
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
@click.command()
|
|
11
|
-
@click.option("--host", default="localhost", help="Host to bind the MCP server to.")
|
|
12
|
-
@click.option("--port", default=None, type=int, help="Port to bind the MCP server to (for HTTP transport).")
|
|
11
|
+
@click.option("--host", default="localhost", help="Host to bind the MCP server to. Default is localhost.")
|
|
12
|
+
@click.option("--port", default=None, type=int, help="Port to bind the MCP server to (for HTTP transport). Default is unset.")
|
|
13
13
|
@click.option(
|
|
14
14
|
"--transport",
|
|
15
15
|
type=click.Choice(["stdio", "http"]),
|
|
16
16
|
default="stdio",
|
|
17
|
-
help="Transport protocol to use (stdio for standard I/O, http for HTTP server).",
|
|
17
|
+
help="Transport protocol to use (stdio for standard I/O, http for HTTP server). Default is stdio.",
|
|
18
18
|
)
|
|
19
19
|
def mcp(host, port, transport):
|
|
20
20
|
"""Start an MCP (Model Context Protocol) server providing Ecosystems CLI functionality.
|
|
@@ -17,13 +17,13 @@ parser = APICommandGenerator.create_api_group("parser")
|
|
|
17
17
|
@click.argument("url", required=True)
|
|
18
18
|
@click.option(
|
|
19
19
|
"--polling-interval",
|
|
20
|
-
type=
|
|
20
|
+
type=click.FloatRange(min=0.1),
|
|
21
21
|
default=None,
|
|
22
22
|
help="Polling interval in seconds. If set, the command will poll the job status until completion.",
|
|
23
23
|
)
|
|
24
24
|
@click.option(
|
|
25
25
|
"--max-wait",
|
|
26
|
-
type=
|
|
26
|
+
type=click.FloatRange(min=0, min_open=True),
|
|
27
27
|
default=DEFAULT_MAX_POLL_WAIT,
|
|
28
28
|
help=f"Maximum seconds to poll before giving up. Default is {DEFAULT_MAX_POLL_WAIT}.",
|
|
29
29
|
)
|
|
@@ -10,6 +10,7 @@ from ecosystems_cli.commands.generator import APICommandGenerator
|
|
|
10
10
|
from ecosystems_cli.constants import DEFAULT_MAX_POLL_WAIT
|
|
11
11
|
from ecosystems_cli.helpers.build_kwargs import build_kwargs
|
|
12
12
|
from ecosystems_cli.helpers.job_polling import submit_and_poll
|
|
13
|
+
from ecosystems_cli.helpers.purl_parser import purl_type_to_registry
|
|
13
14
|
|
|
14
15
|
resolve = APICommandGenerator.create_api_group("resolve")
|
|
15
16
|
|
|
@@ -17,18 +18,22 @@ resolve = APICommandGenerator.create_api_group("resolve")
|
|
|
17
18
|
@override_auto_command(resolve, "create_job", help="Submit a resolve job")
|
|
18
19
|
@click.argument("package_name", required=True)
|
|
19
20
|
@click.argument("registry", required=False)
|
|
20
|
-
@click.option(
|
|
21
|
+
@click.option(
|
|
22
|
+
"--ecosystem",
|
|
23
|
+
default=None,
|
|
24
|
+
help="Ecosystem/purl type (e.g. gem, npm, cargo), mapped to its canonical registry. Alternative to REGISTRY.",
|
|
25
|
+
)
|
|
21
26
|
@click.option("--version", default=None, help="Resolve only with version within this range")
|
|
22
27
|
@click.option("--tree", is_flag=True, default=False, help="Return the full dependency tree with PURLs instead of a flat map")
|
|
23
28
|
@click.option(
|
|
24
29
|
"--polling-interval",
|
|
25
|
-
type=
|
|
30
|
+
type=click.FloatRange(min=0.1),
|
|
26
31
|
default=None,
|
|
27
32
|
help="Polling interval in seconds. If set, the command will poll the job status until completion.",
|
|
28
33
|
)
|
|
29
34
|
@click.option(
|
|
30
35
|
"--max-wait",
|
|
31
|
-
type=
|
|
36
|
+
type=click.FloatRange(min=0, min_open=True),
|
|
32
37
|
default=DEFAULT_MAX_POLL_WAIT,
|
|
33
38
|
help=f"Maximum seconds to poll before giving up. Default is {DEFAULT_MAX_POLL_WAIT}.",
|
|
34
39
|
)
|
|
@@ -66,15 +71,20 @@ def create_job(
|
|
|
66
71
|
"""
|
|
67
72
|
update_context(ctx, timeout, format, domain, mailto)
|
|
68
73
|
|
|
69
|
-
#
|
|
74
|
+
# One of registry / ecosystem is required. The server silently ignores an
|
|
75
|
+
# `ecosystem` query parameter (the job completes instantly with empty
|
|
76
|
+
# results), so an ecosystem is mapped to its canonical registry
|
|
77
|
+
# client-side and always submitted as `registry`. An explicit REGISTRY
|
|
78
|
+
# argument wins over --ecosystem.
|
|
70
79
|
if not registry and not ecosystem:
|
|
71
80
|
raise click.UsageError("Either REGISTRY argument or --ecosystem is required.")
|
|
81
|
+
if not registry:
|
|
82
|
+
registry = purl_type_to_registry(ecosystem)
|
|
72
83
|
|
|
73
84
|
payload = {
|
|
74
85
|
"package_name": package_name,
|
|
86
|
+
"registry": registry,
|
|
75
87
|
**build_kwargs(
|
|
76
|
-
registry=registry,
|
|
77
|
-
ecosystem=ecosystem,
|
|
78
88
|
version=version,
|
|
79
89
|
tree="true" if tree else None,
|
|
80
90
|
),
|
|
@@ -17,13 +17,13 @@ sbom = APICommandGenerator.create_api_group("sbom")
|
|
|
17
17
|
@click.argument("url", required=True)
|
|
18
18
|
@click.option(
|
|
19
19
|
"--polling-interval",
|
|
20
|
-
type=
|
|
20
|
+
type=click.FloatRange(min=0.1),
|
|
21
21
|
default=None,
|
|
22
22
|
help="Polling interval in seconds. If set, the command will poll the job status until completion.",
|
|
23
23
|
)
|
|
24
24
|
@click.option(
|
|
25
25
|
"--max-wait",
|
|
26
|
-
type=
|
|
26
|
+
type=click.FloatRange(min=0, min_open=True),
|
|
27
27
|
default=DEFAULT_MAX_POLL_WAIT,
|
|
28
28
|
help=f"Maximum seconds to poll before giving up. Default is {DEFAULT_MAX_POLL_WAIT}.",
|
|
29
29
|
)
|
|
@@ -22,7 +22,16 @@ class APIConnectionError(APIError):
|
|
|
22
22
|
class APITimeoutError(APIError):
|
|
23
23
|
"""Raised when an API request times out."""
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
def __init__(self, timeout=None):
|
|
26
|
+
self.timeout = timeout
|
|
27
|
+
# str(exception) is shown to the user verbatim; a bare timeout value
|
|
28
|
+
# would render as the meaningless "Error: 20".
|
|
29
|
+
if timeout is not None:
|
|
30
|
+
unit = "second" if timeout == 1 else "seconds"
|
|
31
|
+
message = f"Request timed out after {timeout} {unit}"
|
|
32
|
+
else:
|
|
33
|
+
message = "Request timed out"
|
|
34
|
+
super().__init__(message)
|
|
26
35
|
|
|
27
36
|
|
|
28
37
|
class APIHTTPError(APIError):
|