trainwave-cli 0.4.1__tar.gz → 0.4.2__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 (55) hide show
  1. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/PKG-INFO +1 -1
  2. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/pyproject.toml +1 -1
  3. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/trainwave_cli/cli/jobs.py +51 -14
  4. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/uv.lock +1 -1
  5. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/.dockerignore +0 -0
  6. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/.gitignore +0 -0
  7. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/.gitlab-ci.yml +0 -0
  8. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/Makefile +0 -0
  9. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/README.md +0 -0
  10. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/example/README.md +0 -0
  11. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/example/basic/requirements.txt +0 -0
  12. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/example/basic/run.sh +0 -0
  13. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/example/basic/setup.sh +0 -0
  14. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/example/basic/train.py +0 -0
  15. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/example/basic/trainwave.toml +0 -0
  16. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/example/disk-exhaustion/requirements.txt +0 -0
  17. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/example/disk-exhaustion/run.sh +0 -0
  18. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/example/disk-exhaustion/setup.sh +0 -0
  19. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/example/disk-exhaustion/train.py +0 -0
  20. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/example/disk-exhaustion/trainwave.toml +0 -0
  21. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/example/memory-exhaustion/requirements.txt +0 -0
  22. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/example/memory-exhaustion/run.sh +0 -0
  23. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/example/memory-exhaustion/setup.sh +0 -0
  24. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/example/memory-exhaustion/train.py +0 -0
  25. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/example/memory-exhaustion/trainwave.toml +0 -0
  26. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/example/secret-leak/requirements.txt +0 -0
  27. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/example/secret-leak/run.sh +0 -0
  28. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/example/secret-leak/setup.sh +0 -0
  29. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/example/secret-leak/train.py +0 -0
  30. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/example/secret-leak/trainwave.toml +0 -0
  31. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/pyrightconfig.json +0 -0
  32. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/ruff.toml +0 -0
  33. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/tests/cli/test_auth.py +0 -0
  34. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/tests/cli/test_jobs.py +0 -0
  35. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/tests/cli/test_secrets.py +0 -0
  36. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/tests/cli/test_setup.py +0 -0
  37. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/tests/conftest.py +0 -0
  38. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/tests/test_api.py +0 -0
  39. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/tests/test_io.py +0 -0
  40. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/tests/test_main.py +0 -0
  41. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/tests/test_utils.py +0 -0
  42. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/trainwave_cli/__init__.py +0 -0
  43. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/trainwave_cli/api.py +0 -0
  44. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/trainwave_cli/cli/auth.py +0 -0
  45. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/trainwave_cli/cli/logs.py +0 -0
  46. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/trainwave_cli/cli/offers.py +0 -0
  47. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/trainwave_cli/cli/secrets.py +0 -0
  48. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/trainwave_cli/cli/setup.py +0 -0
  49. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/trainwave_cli/cli/ssh_keys.py +0 -0
  50. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/trainwave_cli/config/config.py +0 -0
  51. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/trainwave_cli/format_utils.py +0 -0
  52. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/trainwave_cli/io.py +0 -0
  53. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/trainwave_cli/main.py +0 -0
  54. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/trainwave_cli/utils.py +0 -0
  55. {trainwave_cli-0.4.1 → trainwave_cli-0.4.2}/trainwave_cli/xceptions.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: trainwave-cli
3
- Version: 0.4.1
3
+ Version: 0.4.2
4
4
  Summary: Trainwave CLI - A command-line interface for managing Trainwave resources
5
5
  Project-URL: Homepage, https://trainwave.ai
6
6
  Project-URL: Documentation, https://trainwave.ai/docs
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "trainwave-cli"
3
- version = "0.4.1"
3
+ version = "0.4.2"
4
4
  description = "Trainwave CLI - A command-line interface for managing Trainwave resources"
5
5
  authors = [{ name = "Johan Backman", email = "johan@trainwave.ai" }]
6
6
  maintainers = [{ name = "Johan Backman", email = "johan@trainwave.ai" }]
@@ -20,7 +20,12 @@ from trainwave_cli.cli.logs import stream_logs
20
20
  from trainwave_cli.config.config import config
21
21
  from trainwave_cli.format_utils import cents_to_dollars_str
22
22
  from trainwave_cli.io import create_tarball
23
- from trainwave_cli.utils import async_command, ensure_api_key, to_dict_recursive, truncate_string
23
+ from trainwave_cli.utils import (
24
+ async_command,
25
+ ensure_api_key,
26
+ to_dict_recursive,
27
+ truncate_string,
28
+ )
24
29
 
25
30
  # Terminal states — no point polling for RUNNING once the job is in one of these.
26
31
  _TERMINAL_JOB_STATES = {
@@ -43,7 +48,9 @@ async def _wait_until_running(
43
48
  typer.echo(f"Job {job.rid} state: {job.state.value}")
44
49
  last_state = job.state
45
50
 
46
- if job.state == JobStatus.RUNNING and any(i.state == "RUNNING" for i in job.instances):
51
+ if job.state == JobStatus.RUNNING and any(
52
+ i.state == "RUNNING" for i in job.instances
53
+ ):
47
54
  return job
48
55
  if job.state in _TERMINAL_JOB_STATES:
49
56
  raise RuntimeError(
@@ -61,6 +68,7 @@ def _ssh_into_job(job: Job, proxy_host: str, proxy_port: int) -> None:
61
68
  typer.echo(f"Connecting to {username}@{proxy_host}:{proxy_port}...")
62
69
  os.execvp("ssh", ["ssh", "-p", str(proxy_port), f"{username}@{proxy_host}"])
63
70
 
71
+
64
72
  app = typer.Typer()
65
73
 
66
74
 
@@ -72,10 +80,14 @@ async def launch( # noqa
72
80
  # Basic job parameters
73
81
  name: Annotated[str, typer.Option(help="The name of the job")],
74
82
  project: Annotated[str, typer.Option(help="The project ID or RID")],
75
- setup_command: Annotated[str, typer.Option(help="The command to run before the job")],
83
+ setup_command: Annotated[
84
+ str, typer.Option(help="The command to run before the job")
85
+ ],
76
86
  run_command: Annotated[str, typer.Option(help="The command to run the job")],
77
87
  # Optional params
78
- organization: Annotated[str | None, typer.Option(help="ID or RID of organization")] = None,
88
+ organization: Annotated[
89
+ str | None, typer.Option(help="ID or RID of organization")
90
+ ] = None,
79
91
  expires: Annotated[
80
92
  str,
81
93
  typer.Option(
@@ -92,17 +104,30 @@ async def launch( # noqa
92
104
  ] = True,
93
105
  exclude_regex: Annotated[
94
106
  str | None,
95
- typer.Option(help="Files matching this pattern will be ignored when packaging up the job"),
107
+ typer.Option(
108
+ help="Files matching this pattern will be ignored when packaging up the job"
109
+ ),
96
110
  ] = None,
97
111
  # Harware parameters
98
- image: Annotated[str, typer.Option(help="The docker image to use as base for the job")] = "",
112
+ image: Annotated[
113
+ str, typer.Option(help="The docker image to use as base for the job")
114
+ ] = "",
99
115
  hdd_size_mb: Annotated[int, typer.Option(help="Hard drive size in MB")] = 20,
100
116
  memory_mb: Annotated[int, typer.Option(help="Memory in MB")] = 0,
101
117
  cpus: Annotated[int, typer.Option(help="Number of CPUs")] = 0,
102
- gpus: Annotated[int, typer.Option(help="Number of GPUs to allocate of the `gpu_type`")] = 0,
103
- gpu_type: Annotated[str, typer.Option(help="Canonical name of the GPU to use")] = "",
118
+ gpus: Annotated[
119
+ int, typer.Option(help="Number of GPUs to allocate of the `gpu_type`")
120
+ ] = 0,
121
+ gpu_type: Annotated[
122
+ str, typer.Option(help="Canonical name of the GPU to use")
123
+ ] = "",
104
124
  compliance_soc2: Annotated[
105
- bool | None, typer.Option("--compliance-soc2", help="Only use SOC2 compliant machines")
125
+ bool | None,
126
+ typer.Option("--compliance-soc2", help="Only use SOC2 compliant machines"),
127
+ ] = None,
128
+ clouds: Annotated[
129
+ list[str] | None,
130
+ typer.Option(help="List of cloud providers to use (e.g. GOOGLE, AWS, AZURE)"),
106
131
  ] = None,
107
132
  interactive: Annotated[
108
133
  bool,
@@ -139,6 +164,8 @@ async def launch( # noqa
139
164
  }
140
165
  if compliance_soc2 is not None:
141
166
  conf["compliance_soc2"] = compliance_soc2
167
+ if clouds is not None:
168
+ conf["clouds"] = clouds
142
169
  if interactive:
143
170
  conf["interactive"] = True
144
171
 
@@ -177,7 +204,9 @@ async def launch( # noqa
177
204
  tarball = create_tarball(
178
205
  Path().cwd(), exclude_gitignore, exclude_regex, show_progress_bar=not json
179
206
  )
180
- await api_client.upload_code(Path(tarball.name), job.upload_url, show_progress_bar=not json)
207
+ await api_client.upload_code(
208
+ Path(tarball.name), job.upload_url, show_progress_bar=not json
209
+ )
181
210
  await api_client.code_submission(job)
182
211
 
183
212
  co = asdict(job.cloud_offer)
@@ -187,7 +216,9 @@ async def launch( # noqa
187
216
  "value": [truncate_string(str(co[k]), 50) for k in tab_keys],
188
217
  }
189
218
  if not json:
190
- typer.echo("\nMatched machine\n" + tabulate(tab_values, headers="keys") + "\n")
219
+ typer.echo(
220
+ "\nMatched machine\n" + tabulate(tab_values, headers="keys") + "\n"
221
+ )
191
222
  typer.echo(f"Cost per hour for this job: ${job.cost_per_hour:.2f}")
192
223
  typer.echo(f"Job created: {job.rid} ({job.id}) -> {job.url}")
193
224
  else:
@@ -221,7 +252,9 @@ async def list_jobs(
221
252
  project: Annotated[str, typer.Option(help="Project ID or RID")] = "",
222
253
  ) -> None:
223
254
  """List all jobs in the current project."""
224
- api_client = Api(config.api_key, config.endpoint, project=project, organization=organization)
255
+ api_client = Api(
256
+ config.api_key, config.endpoint, project=project, organization=organization
257
+ )
225
258
  jobs = await api_client.list_jobs()
226
259
 
227
260
  headers = ["ID", "NAME", "STATUS", "GPUS", "COST", "CREATED"]
@@ -289,7 +322,9 @@ async def ssh(
289
322
  ] = None,
290
323
  extra: Annotated[
291
324
  list[str] | None,
292
- typer.Argument(help="Extra arguments forwarded to ssh (e.g. a command to run)."),
325
+ typer.Argument(
326
+ help="Extra arguments forwarded to ssh (e.g. a command to run)."
327
+ ),
293
328
  ] = None,
294
329
  ) -> None:
295
330
  """Open an SSH session to the running instance of a job."""
@@ -316,7 +351,9 @@ async def ssh(
316
351
  if instance:
317
352
  match = next((i for i in running if instance in (i.rid, i.id)), None)
318
353
  if match is None:
319
- typer.echo(f"Instance {instance} not found among running instances of {job.rid}.")
354
+ typer.echo(
355
+ f"Instance {instance} not found among running instances of {job.rid}."
356
+ )
320
357
  sys.exit(1)
321
358
  target = match
322
359
  elif len(running) > 1:
@@ -1438,7 +1438,7 @@ wheels = [
1438
1438
 
1439
1439
  [[package]]
1440
1440
  name = "trainwave-cli"
1441
- version = "0.3.3"
1441
+ version = "0.4.1"
1442
1442
  source = { editable = "." }
1443
1443
  dependencies = [
1444
1444
  { name = "aiofiles" },
File without changes
File without changes
File without changes
File without changes