toolforge-components-cli 0.0.14__tar.gz → 0.0.17__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.
- {toolforge_components_cli-0.0.14 → toolforge_components_cli-0.0.17}/PKG-INFO +5 -9
- {toolforge_components_cli-0.0.14 → toolforge_components_cli-0.0.17}/pyproject.toml +5 -5
- {toolforge_components_cli-0.0.14 → toolforge_components_cli-0.0.17}/toolforge_components_cli/cli.py +13 -10
- {toolforge_components_cli-0.0.14 → toolforge_components_cli-0.0.17}/toolforge_components_cli/components.py +2 -2
- {toolforge_components_cli-0.0.14 → toolforge_components_cli-0.0.17}/toolforge_components_cli/config.py +2 -2
- {toolforge_components_cli-0.0.14 → toolforge_components_cli-0.0.17}/LICENSE +0 -0
- {toolforge_components_cli-0.0.14 → toolforge_components_cli-0.0.17}/README.md +0 -0
- {toolforge_components_cli-0.0.14 → toolforge_components_cli-0.0.17}/toolforge_components_cli/__init__.py +0 -0
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: toolforge-components-cli
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.17
|
|
4
4
|
Summary: Toolforge components client
|
|
5
5
|
License: GPLv3
|
|
6
|
+
License-File: LICENSE
|
|
6
7
|
Author: Slavina Stefanova
|
|
7
8
|
Author-email: sstefanova@wikimedia.org
|
|
8
|
-
Requires-Python: >=3.
|
|
9
|
+
Requires-Python: >=3.13,<4.0
|
|
9
10
|
Classifier: License :: Other/Proprietary License
|
|
10
11
|
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
17
12
|
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
18
14
|
Requires-Dist: PyYAML (>=6.0,<7.0)
|
|
19
15
|
Requires-Dist: click (>=8.0.3,<9.0.0)
|
|
20
16
|
Requires-Dist: cryptography (>=36.0.1,<37.0.0)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "toolforge-components-cli"
|
|
3
|
-
version = "0.0.
|
|
3
|
+
version = "0.0.17"
|
|
4
4
|
description = "Toolforge components client"
|
|
5
5
|
authors = ["Slavina Stefanova <sstefanova@wikimedia.org>"]
|
|
6
6
|
license = "GPLv3"
|
|
@@ -8,7 +8,7 @@ readme = "README.md"
|
|
|
8
8
|
homepage = "https://gitlab.wikimedia.org/repos/cloud/toolforge/components-cli"
|
|
9
9
|
|
|
10
10
|
[tool.poetry.dependencies]
|
|
11
|
-
python = "^3.
|
|
11
|
+
python = "^3.13"
|
|
12
12
|
click = "^8.0.3"
|
|
13
13
|
PyYAML = "^6.0"
|
|
14
14
|
requests = "^2.27.1"
|
|
@@ -21,9 +21,9 @@ toolforge-weld = ">=1.4,<2.0"
|
|
|
21
21
|
"toolforge-components" = "toolforge_components_cli.cli:main"
|
|
22
22
|
|
|
23
23
|
[tool.poetry.group.dev.dependencies]
|
|
24
|
-
coverage = "^
|
|
25
|
-
pytest = "^
|
|
26
|
-
pytest-cov = "^
|
|
24
|
+
coverage = "^7.13.5"
|
|
25
|
+
pytest = "^9.0.3"
|
|
26
|
+
pytest-cov = "^7.1.0"
|
|
27
27
|
bats-core-pkg = "^0.1.3"
|
|
28
28
|
requests-mock = "^1.11.0"
|
|
29
29
|
|
{toolforge_components_cli-0.0.14 → toolforge_components_cli-0.0.17}/toolforge_components_cli/cli.py
RENAMED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
1
|
from __future__ import annotations
|
|
3
2
|
|
|
4
3
|
import json
|
|
@@ -8,7 +7,7 @@ import subprocess
|
|
|
8
7
|
import sys
|
|
9
8
|
import textwrap
|
|
10
9
|
from textwrap import indent
|
|
11
|
-
from typing import Any
|
|
10
|
+
from typing import Any, TextIO
|
|
12
11
|
|
|
13
12
|
import click
|
|
14
13
|
import yaml
|
|
@@ -27,7 +26,7 @@ from toolforge_components_cli.config import get_loaded_config
|
|
|
27
26
|
|
|
28
27
|
LOGGER = logging.getLogger("toolforge" if __name__ == "__main__" else __name__)
|
|
29
28
|
|
|
30
|
-
MISSING_CONFIG_MSG = "No
|
|
29
|
+
MISSING_CONFIG_MSG = "No CONFIG provided and no data in stdin. Please provide a config file or pipe data."
|
|
31
30
|
ERROR_REPORT_MSG = "Please report this issue to the Toolforge admins if it persists: https://w.wiki/6Zuu"
|
|
32
31
|
DELETE_CONFIRM_MSG = (
|
|
33
32
|
"Are you sure you want to delete the configuration? This cannot be undone."
|
|
@@ -124,6 +123,11 @@ def _display_deployment(deployment_data: dict, as_json: bool, prefix: str = "")
|
|
|
124
123
|
f" {component}({_format_status(run['run_status'])}): {run.get('run_long_status', '')}"
|
|
125
124
|
)
|
|
126
125
|
|
|
126
|
+
if deployment_data.get("tool_config", None):
|
|
127
|
+
click.echo("\n" + click.style("Tool config:", bold=True))
|
|
128
|
+
config_yaml = yaml.dump(data=deployment_data["tool_config"])
|
|
129
|
+
click.echo(indent(text=config_yaml, prefix=" "))
|
|
130
|
+
|
|
127
131
|
|
|
128
132
|
@click.version_option(prog_name="Toolforge Components CLI")
|
|
129
133
|
@click.group(
|
|
@@ -166,7 +170,7 @@ def config():
|
|
|
166
170
|
|
|
167
171
|
|
|
168
172
|
@config.command(name="create", help="Create or update the tool's configuration.")
|
|
169
|
-
@click.argument("
|
|
173
|
+
@click.argument("CONFIG", type=click.File("r"), required=False)
|
|
170
174
|
@click.option(
|
|
171
175
|
"--json",
|
|
172
176
|
"as_json",
|
|
@@ -174,18 +178,17 @@ def config():
|
|
|
174
178
|
help="If set, will output in JSON format",
|
|
175
179
|
)
|
|
176
180
|
@click.pass_context
|
|
177
|
-
def config_create(ctx,
|
|
181
|
+
def config_create(ctx, config: TextIO | None, as_json: bool) -> None:
|
|
178
182
|
components_client = ctx.obj["components_client"]
|
|
179
183
|
display_messages = not as_json
|
|
180
184
|
|
|
181
|
-
if
|
|
185
|
+
if config is None:
|
|
182
186
|
if _should_prompt():
|
|
183
187
|
click.echo(MISSING_CONFIG_MSG, err=True)
|
|
184
188
|
sys.exit(1)
|
|
185
|
-
config_data =
|
|
189
|
+
config_data = yaml.safe_load(sys.stdin)
|
|
186
190
|
else:
|
|
187
|
-
|
|
188
|
-
config_data = yaml.safe_load(f)
|
|
191
|
+
config_data = yaml.safe_load(config)
|
|
189
192
|
|
|
190
193
|
response = components_client.post(
|
|
191
194
|
"/config", json=config_data, display_messages=display_messages
|
|
@@ -598,7 +601,7 @@ def main() -> int:
|
|
|
598
601
|
except subprocess.CalledProcessError as e:
|
|
599
602
|
handle_error(e, debug=debug)
|
|
600
603
|
return e.returncode
|
|
601
|
-
except Exception as e:
|
|
604
|
+
except Exception as e: # noqa: BLE001
|
|
602
605
|
handle_error(e, debug=debug)
|
|
603
606
|
return 1
|
|
604
607
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import socket
|
|
4
|
-
from typing import Any
|
|
4
|
+
from typing import Any
|
|
5
5
|
|
|
6
6
|
import requests
|
|
7
7
|
from toolforge_weld.api_client import ConnectionError, ToolforgeClient
|
|
@@ -30,7 +30,7 @@ def handle_http_exception(e: requests.exceptions.HTTPError) -> Exception:
|
|
|
30
30
|
if e.response is None:
|
|
31
31
|
return ComponentsClientError(message="Got no response", context={})
|
|
32
32
|
|
|
33
|
-
error_class:
|
|
33
|
+
error_class: type[ComponentsClientError | ComponentsClientUserError]
|
|
34
34
|
if 400 <= e.response.status_code <= 499:
|
|
35
35
|
error_class = ComponentsClientUserError
|
|
36
36
|
else:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
from dataclasses import dataclass, field
|
|
4
|
-
from functools import
|
|
4
|
+
from functools import cache
|
|
5
5
|
from typing import Any
|
|
6
6
|
|
|
7
7
|
from toolforge_weld.config import Config, Section, load_config
|
|
@@ -20,6 +20,6 @@ class ComponentsConfig(Section):
|
|
|
20
20
|
return cls(**params)
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
@
|
|
23
|
+
@cache
|
|
24
24
|
def get_loaded_config() -> Config:
|
|
25
25
|
return load_config(client_name="components", extra_sections=[ComponentsConfig])
|
|
File without changes
|
|
File without changes
|
|
File without changes
|