dayhoff-tools 1.5.0__py3-none-any.whl → 1.5.2__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.

Potentially problematic release.


This version of dayhoff-tools might be problematic. Click here for more details.

@@ -1,6 +1,7 @@
1
1
  """Engine and Studio management commands for DHT CLI."""
2
2
 
3
3
  import json
4
+ import shutil
4
5
  import subprocess
5
6
  import sys
6
7
  import time
@@ -365,6 +366,19 @@ def get_ssh_public_key() -> str:
365
366
  )
366
367
 
367
368
 
369
+ def check_session_manager_plugin():
370
+ """Check if AWS Session Manager Plugin is available and warn if not."""
371
+ if shutil.which("session-manager-plugin") is None:
372
+ console.print(
373
+ "[bold red]⚠️ AWS Session Manager Plugin not found![/bold red]\n"
374
+ "SSH connections to engines require the Session Manager Plugin.\n"
375
+ "Please install it following the setup guide:\n"
376
+ "[link]https://github.com/dayhofflabs/nutshell/blob/main/REFERENCE/setup_guides/new-laptop.md[/link]"
377
+ )
378
+ return False
379
+ return True
380
+
381
+
368
382
  def update_ssh_config_entry(engine_name: str, instance_id: str, ssh_user: str):
369
383
  """Add or update a single SSH config entry for the given SSH user."""
370
384
  config_path = Path.home() / ".ssh" / "config"
@@ -850,6 +864,10 @@ def ssh_engine(
850
864
  Pass `--admin` to connect with the underlying [`ec2-user`] account for break-glass or debugging.
851
865
  """
852
866
  username = check_aws_sso()
867
+
868
+ # Check for Session Manager Plugin
869
+ if not check_session_manager_plugin():
870
+ raise typer.Exit(1)
853
871
 
854
872
  # Get all engines to resolve name
855
873
  response = make_api_request("GET", "/engines")
@@ -887,6 +905,10 @@ def config_ssh(
887
905
  """Update SSH config with available engines."""
888
906
  username = check_aws_sso()
889
907
 
908
+ # Only check for Session Manager Plugin if we're not just cleaning
909
+ if not clean and not check_session_manager_plugin():
910
+ raise typer.Exit(1)
911
+
890
912
  if clean:
891
913
  console.print("Removing all managed SSH entries...")
892
914
  else:
@@ -1568,6 +1590,10 @@ def attach_studio(
1568
1590
  """Attach your studio to an engine."""
1569
1591
  username = check_aws_sso()
1570
1592
 
1593
+ # Check for Session Manager Plugin since we'll update SSH config
1594
+ if not check_session_manager_plugin():
1595
+ raise typer.Exit(1)
1596
+
1571
1597
  # Use specified user if provided, otherwise use current user
1572
1598
  target_user = user if user else username
1573
1599
 
@@ -6,8 +6,6 @@ from io import StringIO
6
6
  from pathlib import Path
7
7
  from zoneinfo import ZoneInfo
8
8
 
9
- from ruamel.yaml import YAML
10
-
11
9
  # Import cloud helper lazily inside functions to avoid heavy deps at module load
12
10
 
13
11
 
@@ -135,6 +133,8 @@ def format_yaml_with_meta_spacing(yaml_str: str) -> str:
135
133
 
136
134
  def update_dvc_files(directory):
137
135
  """Traverse directory and update .dvc files with human-readable size, preserving existing formatting"""
136
+ from ruamel.yaml import YAML
137
+
138
138
  yaml = YAML()
139
139
  yaml.preserve_quotes = True
140
140
  yaml.indent(mapping=2, sequence=4, offset=2)
@@ -249,6 +249,8 @@ def import_from_warehouse(
249
249
  subprocess.run(command, check=True)
250
250
 
251
251
  # Copy meta section from warehouse_path to final_path.dvc
252
+ from ruamel.yaml import YAML
253
+
252
254
  yaml = YAML()
253
255
  yaml.preserve_quotes = True
254
256
  yaml.indent(mapping=2, sequence=4, offset=2)
@@ -309,6 +311,8 @@ def add_to_warehouse(
309
311
 
310
312
  # Process each ancestor .dvc file
311
313
  ancestors = []
314
+ from ruamel.yaml import YAML
315
+
312
316
  yaml_loader = YAML()
313
317
  yaml_loader.preserve_quotes = True
314
318
  yaml_loader.indent(mapping=2, sequence=4, offset=2)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: dayhoff-tools
3
- Version: 1.5.0
3
+ Version: 1.5.2
4
4
  Summary: Common tools for all the repos at Dayhoff Labs
5
5
  Author: Daniel Martin-Alarcon
6
6
  Author-email: dma@dayhofflabs.com
@@ -3,7 +3,7 @@ dayhoff_tools/chemistry/standardizer.py,sha256=uMn7VwHnx02nc404eO6fRuS4rsl4dvSPf
3
3
  dayhoff_tools/chemistry/utils.py,sha256=jt-7JgF-GeeVC421acX-bobKbLU_X94KNOW24p_P-_M,2257
4
4
  dayhoff_tools/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  dayhoff_tools/cli/cloud_commands.py,sha256=33qcWLmq-FwEXMdL3F0OHm-5Stlh2r65CldyEZgQ1no,40904
6
- dayhoff_tools/cli/engine_commands.py,sha256=jXaUXbdpZKssFbMdwT6brvTuBmLkYdIHcjt3L5ZP6Ys,86313
6
+ dayhoff_tools/cli/engine_commands.py,sha256=FvQTWb43x2Ns5rOW--ryfWkzzqvSzcpExDKyERY53Zk,87320
7
7
  dayhoff_tools/cli/main.py,sha256=tRN7WCBHg6uyNp6rA54pKTCoVmBntta2i0Yas3bUpZ4,4853
8
8
  dayhoff_tools/cli/swarm_commands.py,sha256=5EyKj8yietvT5lfoz8Zx0iQvVaNgc3SJX1z2zQR6o6M,5614
9
9
  dayhoff_tools/cli/utility_commands.py,sha256=FRZTPrjsG_qmIIqoNxd1Q1vVkS_5w8aY33IrVYVNCLg,18131
@@ -26,8 +26,8 @@ dayhoff_tools/intake/structure.py,sha256=ufN3gAodQxhnt7psK1VTQeu9rKERmo_PhoxIbB4
26
26
  dayhoff_tools/intake/uniprot.py,sha256=BZYJQF63OtPcBBnQ7_P9gulxzJtqyorgyuDiPeOJqE4,16456
27
27
  dayhoff_tools/logs.py,sha256=DKdeP0k0kliRcilwvX0mUB2eipO5BdWUeHwh-VnsICs,838
28
28
  dayhoff_tools/sqlite.py,sha256=jV55ikF8VpTfeQqqlHSbY8OgfyfHj8zgHNpZjBLos_E,18672
29
- dayhoff_tools/warehouse.py,sha256=6HxM8JO8NlYXxXApjptkNfnGrRLMScVeQI_xdFu4His,23062
30
- dayhoff_tools-1.5.0.dist-info/METADATA,sha256=9tvIpdKfGWRFN_caTCipQd0Bi40znW9pa_zGY4-ZVfM,2824
31
- dayhoff_tools-1.5.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
32
- dayhoff_tools-1.5.0.dist-info/entry_points.txt,sha256=iAf4jteNqW3cJm6CO6czLxjW3vxYKsyGLZ8WGmxamSc,49
33
- dayhoff_tools-1.5.0.dist-info/RECORD,,
29
+ dayhoff_tools/warehouse.py,sha256=fV3goH2cH1Y0oLpGERnu4p70P2JfByJHjBh_oMRv9C0,23134
30
+ dayhoff_tools-1.5.2.dist-info/METADATA,sha256=sb8H_nJZYquFb8E_uvrj2xT3stsRS4x_uHdxQk7z15A,2824
31
+ dayhoff_tools-1.5.2.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
32
+ dayhoff_tools-1.5.2.dist-info/entry_points.txt,sha256=iAf4jteNqW3cJm6CO6czLxjW3vxYKsyGLZ8WGmxamSc,49
33
+ dayhoff_tools-1.5.2.dist-info/RECORD,,