dayhoff-tools 1.1.10__py3-none-any.whl → 1.13.12__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.
Files changed (41) hide show
  1. dayhoff_tools/__init__.py +10 -0
  2. dayhoff_tools/cli/cloud_commands.py +179 -43
  3. dayhoff_tools/cli/engine1/__init__.py +323 -0
  4. dayhoff_tools/cli/engine1/engine_core.py +703 -0
  5. dayhoff_tools/cli/engine1/engine_lifecycle.py +136 -0
  6. dayhoff_tools/cli/engine1/engine_maintenance.py +431 -0
  7. dayhoff_tools/cli/engine1/engine_management.py +505 -0
  8. dayhoff_tools/cli/engine1/shared.py +501 -0
  9. dayhoff_tools/cli/engine1/studio_commands.py +825 -0
  10. dayhoff_tools/cli/engines_studios/__init__.py +6 -0
  11. dayhoff_tools/cli/engines_studios/api_client.py +351 -0
  12. dayhoff_tools/cli/engines_studios/auth.py +144 -0
  13. dayhoff_tools/cli/engines_studios/engine-studio-cli.md +1230 -0
  14. dayhoff_tools/cli/engines_studios/engine_commands.py +1151 -0
  15. dayhoff_tools/cli/engines_studios/progress.py +260 -0
  16. dayhoff_tools/cli/engines_studios/simulators/cli-simulators.md +151 -0
  17. dayhoff_tools/cli/engines_studios/simulators/demo.sh +75 -0
  18. dayhoff_tools/cli/engines_studios/simulators/engine_list_simulator.py +319 -0
  19. dayhoff_tools/cli/engines_studios/simulators/engine_status_simulator.py +369 -0
  20. dayhoff_tools/cli/engines_studios/simulators/idle_status_simulator.py +476 -0
  21. dayhoff_tools/cli/engines_studios/simulators/simulator_utils.py +180 -0
  22. dayhoff_tools/cli/engines_studios/simulators/studio_list_simulator.py +374 -0
  23. dayhoff_tools/cli/engines_studios/simulators/studio_status_simulator.py +164 -0
  24. dayhoff_tools/cli/engines_studios/studio_commands.py +755 -0
  25. dayhoff_tools/cli/main.py +106 -7
  26. dayhoff_tools/cli/utility_commands.py +896 -179
  27. dayhoff_tools/deployment/base.py +70 -6
  28. dayhoff_tools/deployment/deploy_aws.py +165 -25
  29. dayhoff_tools/deployment/deploy_gcp.py +78 -5
  30. dayhoff_tools/deployment/deploy_utils.py +20 -7
  31. dayhoff_tools/deployment/job_runner.py +9 -4
  32. dayhoff_tools/deployment/processors.py +230 -418
  33. dayhoff_tools/deployment/swarm.py +47 -12
  34. dayhoff_tools/embedders.py +28 -26
  35. dayhoff_tools/fasta.py +181 -64
  36. dayhoff_tools/warehouse.py +268 -1
  37. {dayhoff_tools-1.1.10.dist-info → dayhoff_tools-1.13.12.dist-info}/METADATA +20 -5
  38. dayhoff_tools-1.13.12.dist-info/RECORD +54 -0
  39. {dayhoff_tools-1.1.10.dist-info → dayhoff_tools-1.13.12.dist-info}/WHEEL +1 -1
  40. dayhoff_tools-1.1.10.dist-info/RECORD +0 -32
  41. {dayhoff_tools-1.1.10.dist-info → dayhoff_tools-1.13.12.dist-info}/entry_points.txt +0 -0
dayhoff_tools/cli/main.py CHANGED
@@ -1,27 +1,58 @@
1
1
  """Entry file for the CLI, which aggregates and aliases all commands."""
2
2
 
3
+ import sys
4
+ from importlib.metadata import PackageNotFoundError, version
5
+
3
6
  import typer
4
7
  from dayhoff_tools.cli.cloud_commands import aws_app, gcp_app
8
+ from dayhoff_tools.cli.engine1 import engine_app, studio_app
5
9
  from dayhoff_tools.cli.utility_commands import (
6
- add_to_warehouse_typer,
10
+ add_dependency,
7
11
  build_and_upload_wheel,
8
12
  delete_local_branch,
9
- get_ancestry,
10
- import_from_warehouse_typer,
11
- install_dependencies,
13
+ remove_dependency,
14
+ sync_with_toml,
12
15
  test_github_actions_locally,
13
16
  update_dependencies,
14
17
  )
18
+ from dayhoff_tools.warehouse import (
19
+ _warn_if_gcp_default_sa,
20
+ add_to_warehouse_typer,
21
+ get_ancestry,
22
+ get_from_warehouse_typer,
23
+ import_from_warehouse_typer,
24
+ )
25
+
26
+
27
+ def _get_dht_version() -> str:
28
+ try:
29
+ return version("dayhoff-tools")
30
+ except PackageNotFoundError:
31
+ # Fallback to package __version__ if running from source
32
+ try:
33
+ from dayhoff_tools import __version__ # type: ignore
34
+
35
+ return __version__
36
+ except Exception:
37
+ return "unknown"
38
+
15
39
 
16
- app = typer.Typer()
40
+ app = typer.Typer(
41
+ help=f"Dayhoff Tools (dh) v{_get_dht_version()}\n\nUse 'dh --version' to print version and exit."
42
+ )
17
43
 
18
44
  # Utility commands
19
45
  app.command("clean")(delete_local_branch)
20
46
 
21
47
  # Dependency Management
22
48
  app.command(
23
- "install", help="Install dependencies based on pyproject.toml and sync environment."
24
- )(install_dependencies)
49
+ "tomlsync",
50
+ help="Sync environment with platform-specific TOML manifest (install/update dependencies).",
51
+ )(sync_with_toml)
52
+ app.command("add", help="Add a dependency to all platform manifests.")(add_dependency)
53
+ app.command("remove", help="Remove a dependency from all platform manifests.")(
54
+ remove_dependency
55
+ )
25
56
  app.command("update", help="Update dayhoff-tools (or all deps) and sync environment.")(
26
57
  update_dependencies
27
58
  )
@@ -30,12 +61,64 @@ app.command("update", help="Update dayhoff-tools (or all deps) and sync environm
30
61
  app.command("gha")(test_github_actions_locally)
31
62
  app.command("wadd")(add_to_warehouse_typer)
32
63
  app.command("wancestry")(get_ancestry)
64
+ app.command("wget")(get_from_warehouse_typer)
33
65
  app.command("wimport")(import_from_warehouse_typer)
34
66
 
35
67
  # Cloud commands
36
68
  app.add_typer(gcp_app, name="gcp", help="Manage GCP authentication and impersonation.")
37
69
  app.add_typer(aws_app, name="aws", help="Manage AWS SSO authentication.")
38
70
 
71
+ # Engine and Studio commands (original implementation)
72
+ app.add_typer(engine_app, name="engine", help="Manage compute engines for development.")
73
+ app.add_typer(studio_app, name="studio", help="Manage persistent development studios.")
74
+
75
+
76
+ # Engine and Studio commands (new implementation with progress tracking)
77
+ # These use Click instead of Typer, so we need a passthrough wrapper
78
+ @app.command(
79
+ "engine2",
80
+ context_settings={"allow_extra_args": True, "ignore_unknown_options": True},
81
+ )
82
+ def engine2_cmd(ctx: typer.Context):
83
+ """Manage engines (new implementation with progress tracking)."""
84
+ from dayhoff_tools.cli.engines_studios import engine_cli
85
+
86
+ # Pass arguments directly to Click CLI
87
+ engine_cli(ctx.args, standalone_mode=False)
88
+
89
+
90
+ @app.command(
91
+ "studio2",
92
+ context_settings={"allow_extra_args": True, "ignore_unknown_options": True},
93
+ )
94
+ def studio2_cmd(ctx: typer.Context):
95
+ """Manage studios (new implementation with progress tracking)."""
96
+ from dayhoff_tools.cli.engines_studios import studio_cli
97
+
98
+ # Pass arguments directly to Click CLI
99
+ studio_cli(ctx.args, standalone_mode=False)
100
+
101
+
102
+ @app.callback(invoke_without_command=True)
103
+ def _version_option(
104
+ ctx: typer.Context,
105
+ version_flag: bool = typer.Option(
106
+ False,
107
+ "--version",
108
+ "-v",
109
+ help="Print version and exit.",
110
+ is_eager=True,
111
+ ),
112
+ ):
113
+ """Global options for the dh CLI (e.g., version)."""
114
+ if version_flag:
115
+ typer.echo(_get_dht_version())
116
+ raise typer.Exit()
117
+ # If no subcommand provided, show help instead of 'Missing command'
118
+ if ctx.invoked_subcommand is None:
119
+ typer.echo(ctx.get_help())
120
+ raise typer.Exit()
121
+
39
122
 
40
123
  @app.command("wheel")
41
124
  def build_and_upload_wheel_command(
@@ -96,6 +179,22 @@ def deploy_command(
96
179
  config_path: str = typer.Argument(help="Path to the YAML configuration file"),
97
180
  ):
98
181
  """Unified deployment command."""
182
+ # Check GCP credentials if deploying in batch mode with GCP
183
+ # Do this early to fail fast before importing deployment code
184
+ if mode == "batch":
185
+ try:
186
+ # Check cloud provider in config
187
+ import yaml
188
+
189
+ with open(config_path, "r") as f:
190
+ config = yaml.safe_load(f)
191
+
192
+ if config.get("cloud") == "gcp":
193
+ _warn_if_gcp_default_sa(force_prompt=True)
194
+ except Exception as e:
195
+ # Don't block deployment if config can't be read or other errors occur
196
+ print(f"Warning: Could not check GCP credentials: {e}", file=sys.stderr)
197
+
99
198
  from dayhoff_tools.deployment.base import deploy
100
199
 
101
200
  deploy(mode, config_path)