toolforge-components-cli 0.0.13__tar.gz → 0.0.15__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.
@@ -1,8 +1,9 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: toolforge-components-cli
3
- Version: 0.0.13
3
+ Version: 0.0.15
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
9
  Requires-Python: >=3.7,<4.0
@@ -15,6 +16,7 @@ Classifier: Programming Language :: Python :: 3.10
15
16
  Classifier: Programming Language :: Python :: 3.11
16
17
  Classifier: Programming Language :: Python :: 3.12
17
18
  Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
18
20
  Requires-Dist: PyYAML (>=6.0,<7.0)
19
21
  Requires-Dist: click (>=8.0.3,<9.0.0)
20
22
  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.13"
3
+ version = "0.0.15"
4
4
  description = "Toolforge components client"
5
5
  authors = ["Slavina Stefanova <sstefanova@wikimedia.org>"]
6
6
  license = "GPLv3"
@@ -8,7 +8,7 @@ import subprocess
8
8
  import sys
9
9
  import textwrap
10
10
  from textwrap import indent
11
- from typing import Any
11
+ from typing import Any, TextIO
12
12
 
13
13
  import click
14
14
  import yaml
@@ -27,7 +27,7 @@ from toolforge_components_cli.config import get_loaded_config
27
27
 
28
28
  LOGGER = logging.getLogger("toolforge" if __name__ == "__main__" else __name__)
29
29
 
30
- MISSING_CONFIG_MSG = "No CONFIG_FILE provided and no data in stdin. Please provide a config file or pipe data."
30
+ MISSING_CONFIG_MSG = "No CONFIG provided and no data in stdin. Please provide a config file or pipe data."
31
31
  ERROR_REPORT_MSG = "Please report this issue to the Toolforge admins if it persists: https://w.wiki/6Zuu"
32
32
  DELETE_CONFIRM_MSG = (
33
33
  "Are you sure you want to delete the configuration? This cannot be undone."
@@ -124,6 +124,11 @@ def _display_deployment(deployment_data: dict, as_json: bool, prefix: str = "")
124
124
  f" {component}({_format_status(run['run_status'])}): {run.get('run_long_status', '')}"
125
125
  )
126
126
 
127
+ if deployment_data.get("tool_config", None):
128
+ click.echo("\n" + click.style("Tool config:", bold=True))
129
+ config_yaml = yaml.dump(data=deployment_data["tool_config"])
130
+ click.echo(indent(text=config_yaml, prefix=" "))
131
+
127
132
 
128
133
  @click.version_option(prog_name="Toolforge Components CLI")
129
134
  @click.group(
@@ -166,7 +171,7 @@ def config():
166
171
 
167
172
 
168
173
  @config.command(name="create", help="Create or update the tool's configuration.")
169
- @click.argument("CONFIG_FILE", type=click.Path(exists=True), required=False)
174
+ @click.argument("CONFIG", type=click.File("r"), required=False)
170
175
  @click.option(
171
176
  "--json",
172
177
  "as_json",
@@ -174,18 +179,17 @@ def config():
174
179
  help="If set, will output in JSON format",
175
180
  )
176
181
  @click.pass_context
177
- def config_create(ctx, config_file: str | None, as_json: bool) -> None:
182
+ def config_create(ctx, config: TextIO | None, as_json: bool) -> None:
178
183
  components_client = ctx.obj["components_client"]
179
184
  display_messages = not as_json
180
185
 
181
- if config_file is None:
186
+ if config is None:
182
187
  if _should_prompt():
183
188
  click.echo(MISSING_CONFIG_MSG, err=True)
184
189
  sys.exit(1)
185
- config_data = json.load(sys.stdin)
190
+ config_data = yaml.safe_load(sys.stdin)
186
191
  else:
187
- with open(config_file) as f:
188
- config_data = yaml.safe_load(f)
192
+ config_data = yaml.safe_load(config)
189
193
 
190
194
  response = components_client.post(
191
195
  "/config", json=config_data, display_messages=display_messages