trainwave-cli 0.2.2__py3-none-any.whl → 0.2.4__py3-none-any.whl

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.
trainwave_cli/cli/auth.py CHANGED
@@ -1,6 +1,6 @@
1
1
  import time
2
2
  import webbrowser
3
- from typing import Annotated
3
+ from typing import Annotated, Optional
4
4
 
5
5
  import typer
6
6
  from loguru import logger
@@ -35,7 +35,7 @@ async def login() -> None:
35
35
 
36
36
  webbrowser.open_new_tab(session_url)
37
37
 
38
- api_token: str | None = None
38
+ api_token: Optional[str] = None
39
39
  end_polling_at = time.time() + 60 * LOGIN_POLLING_TIME
40
40
 
41
41
  with Progress(
trainwave_cli/cli/jobs.py CHANGED
@@ -1,3 +1,6 @@
1
+
2
+ from typing import Optional
3
+
1
4
  import json
2
5
  import os
3
6
  import sys
@@ -40,7 +43,7 @@ async def launch( # noqa
40
43
  run_command: Annotated[str, typer.Option(help="The command to run the job")],
41
44
  # Optional params
42
45
  organization: Annotated[
43
- str | None, typer.Option(help="ID or RID of organization")
46
+ Optional[str], typer.Option(help="ID or RID of organization")
44
47
  ] = None,
45
48
  expires: Annotated[
46
49
  str,
@@ -56,7 +59,7 @@ async def launch( # noqa
56
59
  ),
57
60
  ] = True,
58
61
  exclude_regex: Annotated[
59
- str | None,
62
+ Optional[str],
60
63
  typer.Option(
61
64
  help="Files matching this pattern will be ignored when packaging up the job"
62
65
  ),
@@ -1,7 +1,7 @@
1
1
  import builtins
2
2
  from datetime import datetime, timezone
3
3
  from operator import itemgetter
4
- from typing import Annotated
4
+ from typing import Annotated, Optional
5
5
 
6
6
  import human_readable
7
7
  import typer
@@ -64,7 +64,7 @@ async def list(
64
64
  async def set(
65
65
  organization: Annotated[str, typer.Option(help="The organization ID or RID")],
66
66
  secrets: builtins.list[str],
67
- project: Annotated[str | None, typer.Option(help="Project ID or RID")] = None,
67
+ project: Annotated[Optional[str], typer.Option(help="Project ID or RID")] = None,
68
68
  ) -> None:
69
69
  secret_dict: dict[str, str] = {}
70
70
 
@@ -94,7 +94,22 @@ async def set(
94
94
  @ensure_api_key
95
95
  async def unset(
96
96
  organization: Annotated[str, typer.Option(help="The organization ID or RID")],
97
- secrets: builtins.list[str],
97
+ secret_names: builtins.list[str],
98
98
  ) -> None:
99
99
  api_client = Api(config.api_key, config.endpoint)
100
- await api_client.unset_secrets(organization, secrets)
100
+
101
+ existing_secrets = await api_client.list_secrets(organization)
102
+ lookup = {
103
+ secret.name: secret.id for secret in existing_secrets
104
+ }
105
+
106
+ secret_ids: builtins.list[str] = []
107
+ while secret_names:
108
+ current = secret_names.pop()
109
+ if current not in lookup:
110
+ typer.echo(f"Error: Secret '{current}' not found.", err=True)
111
+ raise typer.Exit(code=1)
112
+
113
+ secret_ids.append(lookup[current])
114
+
115
+ await api_client.unset_secrets(organization, secret_ids)
@@ -1,7 +1,7 @@
1
1
  import copy
2
2
  import time
3
3
  import webbrowser
4
- from typing import Annotated, Any, cast
4
+ from typing import Annotated, Any, Optional, cast
5
5
 
6
6
  import toml
7
7
  import typer
@@ -68,7 +68,7 @@ async def _run_setup_guide(existing_config: dict[str, Any]) -> dict[str, Any]:
68
68
  @ensure_api_key
69
69
  async def default(
70
70
  config: Annotated[
71
- str | None, typer.Option(help="Provide a config path")
71
+ Optional[str], typer.Option(help="Provide a config path")
72
72
  ] = "trainwave.toml",
73
73
  accept: Annotated[
74
74
  bool, typer.Option(help="Accept overwrite of config without prompt")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: trainwave-cli
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary:
5
5
  Author: Johan Backman
6
6
  Author-email: johan@trainwave.ai
@@ -22,7 +22,7 @@ Requires-Dist: pytimeparse (>=1.1.8,<2.0.0)
22
22
  Requires-Dist: tabulate (>=0.9.0,<0.10.0)
23
23
  Requires-Dist: toml (>=0.10.2,<0.11.0)
24
24
  Requires-Dist: tqdm (>=4.66.4,<5.0.0)
25
- Requires-Dist: typer (>=0.12.3,<0.13.0)
25
+ Requires-Dist: typer (>=0.12.5,<0.13.0)
26
26
  Requires-Dist: typer-config[all] (>=1.4.0,<2.0.0)
27
27
  Requires-Dist: websockets (>=12.0,<13.0)
28
28
  Description-Content-Type: text/markdown
@@ -1,17 +1,17 @@
1
1
  trainwave_cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  trainwave_cli/api.py,sha256=LoFN0IImiOABphnGMu3Xc-ayu59q1qPXmlYaMvQ1ejc,9100
3
- trainwave_cli/cli/auth.py,sha256=VaMKtUypQRzf0u3s2E8pZ-l-_FXW1S3A18NRJwHzw_s,3188
4
- trainwave_cli/cli/jobs.py,sha256=_6V-NNM5giADdHAADzSX-IOweDfvKLsGpY3Owffp-wU,8536
3
+ trainwave_cli/cli/auth.py,sha256=-FPrlPqquskDp4I9PWk3wP-ukwu75UqGwY-rEgvicBY,3201
4
+ trainwave_cli/cli/jobs.py,sha256=fGH0kDcScdcNB7oZO78EeQ3HtcpI5GbSQgetpNdcFKY,8572
5
5
  trainwave_cli/cli/offers.py,sha256=ir5Nbtc1pH8lKWOn_gvaOD1_bCYX4k3OQzKSrNmUd2Q,630
6
- trainwave_cli/cli/secrets.py,sha256=EP1Wo2fsBs9N1K3xhALLuYp2Lhx-L_TbHD7KjPDfCIM,3166
7
- trainwave_cli/cli/setup.py,sha256=O0fchvs4vNN9t8e-QcnO18vZtwZoD0gPflhUHJKiEtI,3900
6
+ trainwave_cli/cli/secrets.py,sha256=3rd0XkTe8notd7BKq3rXYU-3hZ1dfPVICJ7zEBFK_GE,3630
7
+ trainwave_cli/cli/setup.py,sha256=oa6rO8J66Tio4msxgUmA7KfztACOLCySe84XsPfkrTg,3913
8
8
  trainwave_cli/config/config.py,sha256=K3t6whTEYf9GSUkoIVqmqGDCzbteHPR_2B5nbErGH94,1477
9
9
  trainwave_cli/format_utils.py,sha256=wSZRLKbhAKE2UjliIr8CRiXiVfFRsBtCLpBmoxDKdOM,101
10
10
  trainwave_cli/io.py,sha256=OHiV9h7fXLnlexvFsD94k68Pdrni220fcjBQFYnfGTE,1780
11
11
  trainwave_cli/main.py,sha256=FEqOckEjlIkyIGuegeYMnQM7H7jK3CCtKFXSn7o5ZTM,2143
12
12
  trainwave_cli/utils.py,sha256=1j5uKonbwVikDZJQPUSG-0zPoXZzIb6HF6jidsYieG8,1619
13
13
  trainwave_cli/xceptions.py,sha256=42wPK7ib0hLzSvzqLMHdWRWx81hpsl7no9h32Ssgj8I,116
14
- trainwave_cli-0.2.2.dist-info/METADATA,sha256=8ybolW-7rJFEuc0dgLo5hWuHaWLjTZ_7j7re138TKIU,1066
15
- trainwave_cli-0.2.2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
16
- trainwave_cli-0.2.2.dist-info/entry_points.txt,sha256=6NDgl5S7Igb09TPdoUBcI_B1Lj2pB59NAfs2IcnMDOk,54
17
- trainwave_cli-0.2.2.dist-info/RECORD,,
14
+ trainwave_cli-0.2.4.dist-info/METADATA,sha256=zmvvC1AUxxdGwM4HeI1iynfRtIyEfWaOkQwhxFreaww,1066
15
+ trainwave_cli-0.2.4.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
16
+ trainwave_cli-0.2.4.dist-info/entry_points.txt,sha256=6NDgl5S7Igb09TPdoUBcI_B1Lj2pB59NAfs2IcnMDOk,54
17
+ trainwave_cli-0.2.4.dist-info/RECORD,,