dayhoff-tools 1.7.5__py3-none-any.whl → 1.8.0__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.
dayhoff_tools/cli/main.py CHANGED
@@ -22,6 +22,7 @@ from dayhoff_tools.warehouse import (
22
22
  import_from_warehouse_typer,
23
23
  )
24
24
 
25
+
25
26
  def _get_dht_version() -> str:
26
27
  try:
27
28
  return version("dayhoff-tools")
@@ -35,7 +36,9 @@ def _get_dht_version() -> str:
35
36
  return "unknown"
36
37
 
37
38
 
38
- app = typer.Typer(help=f"Dayhoff Tools (dh) v{_get_dht_version()}\n\nUse 'dh --version' to print version and exit.")
39
+ app = typer.Typer(
40
+ help=f"Dayhoff Tools (dh) v{_get_dht_version()}\n\nUse 'dh --version' to print version and exit."
41
+ )
39
42
 
40
43
  # Utility commands
41
44
  app.command("clean")(delete_local_branch)
@@ -73,7 +76,7 @@ def _version_option(
73
76
  "-v",
74
77
  help="Print version and exit.",
75
78
  is_eager=True,
76
- )
79
+ ),
77
80
  ):
78
81
  """Global options for the dh CLI (e.g., version)."""
79
82
  if version_flag:
@@ -9,7 +9,6 @@ from pathlib import Path
9
9
 
10
10
  import toml
11
11
  import typer
12
- import yaml
13
12
 
14
13
  # Import cloud helper lazily inside functions to avoid heavy deps at module load
15
14
 
@@ -370,11 +369,15 @@ def install_dependencies(
370
369
  print("Ensuring lock file matches pyproject.mac.toml (Mac devcon)…")
371
370
  lock_cmd = ["uv", "lock"]
372
371
  print(f"Running command: {BLUE}{' '.join(lock_cmd)}{RESET}")
373
- subprocess.run(lock_cmd, check=True, capture_output=True, cwd=str(mac_uv_dir))
372
+ subprocess.run(
373
+ lock_cmd, check=True, capture_output=True, cwd=str(mac_uv_dir)
374
+ )
374
375
 
375
376
  # Sync into the active environment
376
377
  if install_project:
377
- print("Syncing dependencies into ACTIVE env and installing project [full]…")
378
+ print(
379
+ "Syncing dependencies into ACTIVE env and installing project [full]…"
380
+ )
378
381
  sync_cmd = ["uv", "sync", "--all-groups", "--active"]
379
382
  print(f"Running command: {BLUE}{' '.join(sync_cmd)}{RESET}")
380
383
  subprocess.run(sync_cmd, check=True, cwd=str(mac_uv_dir))
@@ -385,7 +388,13 @@ def install_dependencies(
385
388
  print("Project installed with 'full' extras successfully.")
386
389
  else:
387
390
  print("Syncing dependencies into ACTIVE env (project not installed)…")
388
- sync_cmd = ["uv", "sync", "--all-groups", "--no-install-project", "--active"]
391
+ sync_cmd = [
392
+ "uv",
393
+ "sync",
394
+ "--all-groups",
395
+ "--no-install-project",
396
+ "--active",
397
+ ]
389
398
  print(f"Running command: {BLUE}{' '.join(sync_cmd)}{RESET}")
390
399
  subprocess.run(sync_cmd, check=True, cwd=str(mac_uv_dir))
391
400
  print("Dependencies synced successfully (project not installed).")
@@ -403,7 +412,13 @@ def install_dependencies(
403
412
  subprocess.run(sync_cmd, check=True)
404
413
  else:
405
414
  print("Syncing dependencies into ACTIVE env (project not installed)…")
406
- sync_cmd = ["uv", "sync", "--all-groups", "--no-install-project", "--active"]
415
+ sync_cmd = [
416
+ "uv",
417
+ "sync",
418
+ "--all-groups",
419
+ "--no-install-project",
420
+ "--active",
421
+ ]
407
422
  print(f"Running command: {BLUE}{' '.join(sync_cmd)}{RESET}")
408
423
  subprocess.run(sync_cmd, check=True)
409
424
  print("Dependencies synced successfully (project not installed).")
@@ -436,16 +451,16 @@ def update_dependencies(
436
451
  """Update dependencies to newer versions (Mac-aware, active venv friendly).
437
452
 
438
453
  - Default Action (no flags): Updates only 'dayhoff-tools' package to latest,
439
- updates the manifest's version constraint, and syncs.
454
+ updates ALL manifest files with the version constraint, and syncs.
440
455
  - Flags:
441
456
  --all/-a: Updates all dependencies (uv lock --upgrade) and syncs.
442
457
 
443
- Mac devcontainer behavior:
444
- - If STUDIO_PLATFORM=mac and `pyproject.mac.toml` exists, operate in `.mac_uv_project/`:
445
- copy `pyproject.mac.toml` to `.mac_uv_project/pyproject.toml`, run uv there, and always
446
- use `--active` for sync so installs target the active venv.
447
- - Update the constraint inside `pyproject.mac.toml`. If not found, try `pyproject.toml`.
448
- Otherwise (non-Mac), operate in repo root and also target the active venv during sync.
458
+ Cross-platform behavior:
459
+ - Always updates BOTH `pyproject.toml` and `pyproject.mac.toml` (if they exist)
460
+ to ensure version consistency across AWS and Mac platforms.
461
+ - On Mac: If STUDIO_PLATFORM=mac and `pyproject.mac.toml` exists, operates in
462
+ `.mac_uv_project/` and copies `pyproject.mac.toml` to `.mac_uv_project/pyproject.toml`.
463
+ - Always uses `--active` for sync to target the active venv.
449
464
  """
450
465
  # ANSI color codes
451
466
  BLUE = "\033[94m"
@@ -491,7 +506,7 @@ def update_dependencies(
491
506
  print(f"Running command: {BLUE}{' '.join(lock_cmd)}{RESET}")
492
507
  subprocess.run(lock_cmd, check=True, capture_output=True, cwd=uv_cwd)
493
508
 
494
- # Step 2: Update pyproject.toml only if doing the dayhoff update (default)
509
+ # Step 2: Update both manifest files if doing the dayhoff update (default)
495
510
  if run_pyproject_update:
496
511
  print(f"Reading {lock_file_path} to find new dayhoff-tools version...")
497
512
  if not lock_file_path.exists():
@@ -518,59 +533,62 @@ def update_dependencies(
518
533
  return
519
534
 
520
535
  print(f"Found dayhoff-tools version {locked_version} in lock file.")
521
- print(f"Updating {manifest_path_for_constraint} version constraint...")
522
- try:
523
- content = manifest_path_for_constraint.read_text()
524
536
 
525
- package_name = "dayhoff-tools"
526
- package_name_esc = re.escape(package_name)
537
+ # Update both manifest files to ensure consistency across platforms
538
+ manifest_files_to_update = []
539
+ if pyproject_path.exists():
540
+ manifest_files_to_update.append(pyproject_path)
541
+ if mac_manifest.exists():
542
+ manifest_files_to_update.append(mac_manifest)
527
543
 
528
- # Regex to match the dependency line, with optional extras and version spec
529
- pattern = re.compile(
530
- rf"^(\s*['\"]){package_name_esc}(\[[^]]+\])?(?:[><=~^][^'\"]*)?(['\"].*)$",
531
- re.MULTILINE,
532
- )
544
+ if not manifest_files_to_update:
545
+ print("Warning: No manifest files found to update.")
546
+ return
533
547
 
534
- new_constraint_text = f">={locked_version}"
548
+ package_name = "dayhoff-tools"
549
+ package_name_esc = re.escape(package_name)
535
550
 
536
- def _repl(match: re.Match):
537
- prefix = match.group(1)
538
- extras = match.group(2) or ""
539
- suffix = match.group(3)
540
- return (
541
- f"{prefix}{package_name}{extras}{new_constraint_text}{suffix}"
542
- )
551
+ # Regex to match the dependency line, with optional extras and version spec
552
+ pattern = re.compile(
553
+ rf"^(\s*['\"]){package_name_esc}(\[[^]]+\])?(?:[><=~^][^'\"]*)?(['\"].*)$",
554
+ re.MULTILINE,
555
+ )
543
556
 
544
- new_content, num_replacements = pattern.subn(_repl, content)
545
- if num_replacements > 0:
546
- manifest_path_for_constraint.write_text(new_content)
547
- print(
548
- f"Updated dayhoff-tools constraint in {manifest_path_for_constraint} to '{new_constraint_text}'"
549
- )
550
- else:
551
- # Fallback: try the root pyproject if we were targeting mac manifest
552
- if manifest_path_for_constraint != pyproject_path and pyproject_path.exists():
553
- content2 = pyproject_path.read_text()
554
- new_content2, n2 = pattern.subn(_repl, content2)
555
- if n2 > 0:
556
- pyproject_path.write_text(new_content2)
557
- print(
558
- f"Updated dayhoff-tools constraint in {pyproject_path} to '{new_constraint_text}'"
559
- )
560
- else:
561
- print(
562
- f"Warning: Could not find dayhoff-tools dependency line in {manifest_path_for_constraint} or {pyproject_path} to update constraint."
563
- )
557
+ new_constraint_text = f">={locked_version}"
558
+
559
+ def _repl(match: re.Match):
560
+ prefix = match.group(1)
561
+ extras = match.group(2) or ""
562
+ suffix = match.group(3)
563
+ return f"{prefix}{package_name}{extras}{new_constraint_text}{suffix}"
564
+
565
+ # Update all manifest files
566
+ updated_files = []
567
+ for manifest_file in manifest_files_to_update:
568
+ try:
569
+ print(f"Updating {manifest_file} version constraint...")
570
+ content = manifest_file.read_text()
571
+ new_content, num_replacements = pattern.subn(_repl, content)
572
+ if num_replacements > 0:
573
+ manifest_file.write_text(new_content)
574
+ print(
575
+ f"Updated dayhoff-tools constraint in {manifest_file} to '{new_constraint_text}'"
576
+ )
577
+ updated_files.append(str(manifest_file))
564
578
  else:
565
579
  print(
566
- f"Warning: Could not find dayhoff-tools dependency line in {manifest_path_for_constraint} to update constraint."
580
+ f"Warning: Could not find dayhoff-tools dependency line in {manifest_file}"
567
581
  )
568
- except FileNotFoundError:
569
- print(f"Error: {manifest_path_for_constraint} not found.")
570
- return
571
- except Exception as e:
572
- print(f"Error updating {manifest_path_for_constraint}: {e}")
573
- print("Proceeding with sync despite pyproject.toml update error.")
582
+ except FileNotFoundError:
583
+ print(f"Warning: {manifest_file} not found.")
584
+ except Exception as e:
585
+ print(f"Error updating {manifest_file}: {e}")
586
+
587
+ if not updated_files:
588
+ print(
589
+ "Warning: No manifest files were successfully updated with dayhoff-tools constraint."
590
+ )
591
+ print("Proceeding with sync despite manifest update failures.")
574
592
 
575
593
  # Step 3: Sync environment
576
594
  print("Syncing environment with updated lock file...")
@@ -584,7 +602,7 @@ def update_dependencies(
584
602
  print("All dependencies updated and environment synced successfully.")
585
603
  else: # Default case (dayhoff update)
586
604
  print(
587
- "dayhoff-tools updated, pyproject.toml modified, and environment synced successfully."
605
+ "dayhoff-tools updated, manifest files modified, and environment synced successfully."
588
606
  )
589
607
 
590
608
  except subprocess.CalledProcessError as e:
@@ -19,7 +19,9 @@ def _find_project_root() -> Path | None:
19
19
  """
20
20
  current_dir = Path.cwd().resolve()
21
21
  while current_dir != current_dir.parent:
22
- if (current_dir / ".git").is_dir() or (current_dir / "pyproject.toml").is_file():
22
+ if (current_dir / ".git").is_dir() or (
23
+ current_dir / "pyproject.toml"
24
+ ).is_file():
23
25
  return current_dir
24
26
  current_dir = current_dir.parent
25
27
  # Check the final directory in the hierarchy (e.g., '/')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: dayhoff-tools
3
- Version: 1.7.5
3
+ Version: 1.8.0
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
@@ -4,9 +4,9 @@ dayhoff_tools/chemistry/utils.py,sha256=jt-7JgF-GeeVC421acX-bobKbLU_X94KNOW24p_P
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
6
  dayhoff_tools/cli/engine_commands.py,sha256=0syRVrJjWtRi7Y_q7MbEA5PKJ8TSXtEodHzxXu2Ymhs,102461
7
- dayhoff_tools/cli/main.py,sha256=LLMybU9KbtV_F4rwvoYAQZKTTF1nswlSZIfDMKdkh00,5925
7
+ dayhoff_tools/cli/main.py,sha256=LoFs3SI4fdCjP4pdxEAhri-_q0dmNYupmBCRE4KbBac,5933
8
8
  dayhoff_tools/cli/swarm_commands.py,sha256=5EyKj8yietvT5lfoz8Zx0iQvVaNgc3SJX1z2zQR6o6M,5614
9
- dayhoff_tools/cli/utility_commands.py,sha256=q2XyNy1uMGKg95cRXv1uA4MhaUDqlDBvkQwmvRo3hnA,25865
9
+ dayhoff_tools/cli/utility_commands.py,sha256=WQTHOh1MttuxaJjl2c6zMa4x7_JuaKMQgcyotYrU3GA,25883
10
10
  dayhoff_tools/deployment/base.py,sha256=mYp560l6hSDFtyY2H42VoM8k9VUzfwuiyh9Knqpgc28,17441
11
11
  dayhoff_tools/deployment/deploy_aws.py,sha256=GvZpE2YIFA5Dl9rkAljFjtUypmPDNbWgw8NicHYTP24,18265
12
12
  dayhoff_tools/deployment/deploy_gcp.py,sha256=xgaOVsUDmP6wSEMYNkm1yRNcVskfdz80qJtCulkBIAM,8860
@@ -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=heaYc64qplgN3_1WVPFmqj53goStioWwY5NqlWc4c0s,24453
30
- dayhoff_tools-1.7.5.dist-info/METADATA,sha256=tnZl6OD70iojC4Avmej4LaBhAAQO2afIzZ4PBj6BEws,2914
31
- dayhoff_tools-1.7.5.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
32
- dayhoff_tools-1.7.5.dist-info/entry_points.txt,sha256=iAf4jteNqW3cJm6CO6czLxjW3vxYKsyGLZ8WGmxamSc,49
33
- dayhoff_tools-1.7.5.dist-info/RECORD,,
29
+ dayhoff_tools/warehouse.py,sha256=UETBtZD3r7WgvURqfGbyHlT7cxoiVq8isjzMuerKw8I,24475
30
+ dayhoff_tools-1.8.0.dist-info/METADATA,sha256=c3CxOCAQQvjORyAe-o5EylhK1QWmSIpxKW3HeTZeVdI,2914
31
+ dayhoff_tools-1.8.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
32
+ dayhoff_tools-1.8.0.dist-info/entry_points.txt,sha256=iAf4jteNqW3cJm6CO6czLxjW3vxYKsyGLZ8WGmxamSc,49
33
+ dayhoff_tools-1.8.0.dist-info/RECORD,,