dayhoff-tools 1.11.6__py3-none-any.whl → 1.11.8__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.
@@ -570,12 +570,33 @@ def sync_with_toml(
570
570
  ]
571
571
  print(f"Running command: {BLUE}{' '.join(sync_cmd)}{RESET}")
572
572
  subprocess.run(sync_cmd, check=True, cwd=str(mac_uv_dir))
573
+
573
574
  # Install project from repo root (where source code actually is)
575
+ # Temporarily create pyproject.toml at repo root for UV
574
576
  print("Installing project with 'full' extras from repo root…")
575
- pip_install_cmd = ["uv", "pip", "install", "-e", ".[full]"]
576
- print(f"Running command: {BLUE}{' '.join(pip_install_cmd)}{RESET}")
577
- subprocess.run(pip_install_cmd, check=True)
578
- print("Project installed with 'full' extras successfully.")
577
+ temp_pyproject = False
578
+ backup_created = False
579
+ try:
580
+ if not Path("pyproject.toml").exists():
581
+ # Create temp pyproject.toml from platform manifest
582
+ Path("pyproject.toml").write_text(mac_manifest.read_text())
583
+ temp_pyproject = True
584
+ elif Path("pyproject.toml").is_symlink():
585
+ # Backup existing symlink
586
+ Path("pyproject.toml").rename("pyproject.toml.sync.bak")
587
+ Path("pyproject.toml").write_text(mac_manifest.read_text())
588
+ backup_created = True
589
+
590
+ pip_install_cmd = ["uv", "pip", "install", "-e", ".[full]"]
591
+ print(f"Running command: {BLUE}{' '.join(pip_install_cmd)}{RESET}")
592
+ subprocess.run(pip_install_cmd, check=True)
593
+ print("Project installed with 'full' extras successfully.")
594
+ finally:
595
+ # Clean up temp pyproject.toml
596
+ if temp_pyproject and Path("pyproject.toml").exists():
597
+ Path("pyproject.toml").unlink()
598
+ if backup_created and Path("pyproject.toml.sync.bak").exists():
599
+ Path("pyproject.toml.sync.bak").rename("pyproject.toml")
579
600
  else:
580
601
  print("Syncing dependencies into ACTIVE env (project not installed)…")
581
602
  sync_cmd = [
@@ -624,12 +645,35 @@ def sync_with_toml(
624
645
  ]
625
646
  print(f"Running command: {BLUE}{' '.join(sync_cmd)}{RESET}")
626
647
  subprocess.run(sync_cmd, check=True, cwd=str(aws_uv_dir))
648
+
627
649
  # Install project from repo root (where source code actually is)
650
+ # Temporarily create pyproject.toml at repo root for UV
628
651
  print("Installing project with 'full' extras from repo root…")
629
- pip_install_cmd = ["uv", "pip", "install", "-e", ".[full]"]
630
- print(f"Running command: {BLUE}{' '.join(pip_install_cmd)}{RESET}")
631
- subprocess.run(pip_install_cmd, check=True)
632
- print("Project installed with 'full' extras successfully.")
652
+ temp_pyproject = False
653
+ backup_created = False
654
+ try:
655
+ if not Path("pyproject.toml").exists():
656
+ # Create temp pyproject.toml from platform manifest
657
+ Path("pyproject.toml").write_text(aws_manifest.read_text())
658
+ temp_pyproject = True
659
+ elif Path("pyproject.toml").is_symlink():
660
+ # Backup existing symlink
661
+ Path("pyproject.toml").rename("pyproject.toml.sync.bak")
662
+ Path("pyproject.toml").write_text(aws_manifest.read_text())
663
+ backup_created = True
664
+
665
+ pip_install_cmd = ["uv", "pip", "install", "-e", ".[full]"]
666
+ print(
667
+ f"Running command: {BLUE}{' '.join(pip_install_cmd)}{RESET}"
668
+ )
669
+ subprocess.run(pip_install_cmd, check=True)
670
+ print("Project installed with 'full' extras successfully.")
671
+ finally:
672
+ # Clean up temp pyproject.toml
673
+ if temp_pyproject and Path("pyproject.toml").exists():
674
+ Path("pyproject.toml").unlink()
675
+ if backup_created and Path("pyproject.toml.sync.bak").exists():
676
+ Path("pyproject.toml.sync.bak").rename("pyproject.toml")
633
677
  else:
634
678
  print(
635
679
  "Syncing dependencies into ACTIVE env (project not installed)…"
@@ -680,6 +724,64 @@ def _get_all_platform_manifests():
680
724
  return manifest_files
681
725
 
682
726
 
727
+ def _resolve_package_version(package_name: str) -> str | None:
728
+ """Resolve a package version by running uv lock and parsing the lock file.
729
+
730
+ Args:
731
+ package_name: Name of the package to resolve
732
+
733
+ Returns:
734
+ Resolved version string, or None if resolution failed
735
+ """
736
+ import os
737
+
738
+ try:
739
+ # Determine which manifest to use (prefer Mac, then AWS)
740
+ platform = os.environ.get("STUDIO_PLATFORM", "aws")
741
+ manifest_path = None
742
+ uv_dir = None
743
+
744
+ if platform == "mac" and Path("pyproject.mac.toml").exists():
745
+ manifest_path = Path("pyproject.mac.toml")
746
+ uv_dir = Path(".mac_uv_project")
747
+ elif Path("pyproject.aws.toml").exists():
748
+ manifest_path = Path("pyproject.aws.toml")
749
+ uv_dir = Path(".aws_uv_project")
750
+ elif Path("pyproject.mac.toml").exists():
751
+ # Fallback to Mac if AWS doesn't exist
752
+ manifest_path = Path("pyproject.mac.toml")
753
+ uv_dir = Path(".mac_uv_project")
754
+ else:
755
+ return None
756
+
757
+ # Create temp directory and copy manifest
758
+ uv_dir.mkdir(parents=True, exist_ok=True)
759
+ (uv_dir / "pyproject.toml").write_text(manifest_path.read_text())
760
+
761
+ # Copy README if it exists
762
+ if Path("README.md").exists():
763
+ (uv_dir / "README.md").write_text(Path("README.md").read_text())
764
+
765
+ # Run uv lock (suppress output)
766
+ subprocess.run(["uv", "lock"], cwd=str(uv_dir), check=True, capture_output=True)
767
+
768
+ # Parse lock file
769
+ lock_file = uv_dir / "uv.lock"
770
+ if not lock_file.exists():
771
+ return None
772
+
773
+ lock_data = toml.load(lock_file)
774
+ for package in lock_data.get("package", []):
775
+ if package.get("name") == package_name:
776
+ return package.get("version")
777
+
778
+ return None
779
+
780
+ except Exception as e:
781
+ print(f"Warning: Failed to resolve version: {e}")
782
+ return None
783
+
784
+
683
785
  def _update_all_manifests_for_dayhoff_tools(new_version: str):
684
786
  """Update dayhoff-tools constraint in all platform manifests."""
685
787
  import re
@@ -756,8 +858,9 @@ def add_dependency(
756
858
  section_name = "dev dependencies" if dev else "main dependencies"
757
859
  print(f"Adding '{package}' to {section_name} in all platform manifests...")
758
860
 
759
- # Parse package name to check for duplicates
861
+ # Parse package name to check for duplicates and version specs
760
862
  package_name = re.split(r"[<>=~!\[]", package)[0].strip()
863
+ has_version_spec = any(c in package for c in ["<", ">", "=", "~", "!"])
761
864
 
762
865
  for manifest_file in manifest_files:
763
866
  try:
@@ -841,6 +944,50 @@ def add_dependency(
841
944
  print(f"Error updating {manifest_file}: {e}")
842
945
 
843
946
  print(f"\n✅ Added '{package}' to all platform manifests")
947
+
948
+ # If no version specified, resolve and add version constraint
949
+ if not has_version_spec:
950
+ print(f"\n🔍 Resolving version for '{package_name}'...")
951
+ resolved_version = _resolve_package_version(package_name)
952
+
953
+ if resolved_version:
954
+ print(f"📌 Resolved to version {resolved_version}")
955
+ print(
956
+ f"Updating manifests with version constraint '>={resolved_version}'..."
957
+ )
958
+
959
+ # Update all manifests to add version constraint
960
+ for manifest_file in manifest_files:
961
+ try:
962
+ content = manifest_file.read_text()
963
+ # Replace unversioned package with versioned one
964
+ pattern = re.compile(
965
+ rf'^(\s*["\']){re.escape(package_name)}(["\'],?)(.*)$',
966
+ re.MULTILINE,
967
+ )
968
+
969
+ def replace_with_version(match):
970
+ prefix = match.group(1)
971
+ suffix = match.group(2)
972
+ rest = match.group(3)
973
+ return (
974
+ f"{prefix}{package_name}>={resolved_version}{suffix}{rest}"
975
+ )
976
+
977
+ new_content = pattern.sub(replace_with_version, content)
978
+ manifest_file.write_text(new_content)
979
+ print(f"✅ Updated {manifest_file} with version constraint")
980
+ except Exception as e:
981
+ print(f"Warning: Could not update version in {manifest_file}: {e}")
982
+
983
+ print(
984
+ f"\n✅ Added '{package_name}>={resolved_version}' to all platform manifests"
985
+ )
986
+ else:
987
+ print(
988
+ f"⚠️ Could not resolve version for '{package_name}', left unversioned"
989
+ )
990
+
844
991
  print(
845
992
  f"\nRun {BLUE}dh tomlsync{RESET} to install the new dependency in your environment."
846
993
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dayhoff-tools
3
- Version: 1.11.6
3
+ Version: 1.11.8
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
@@ -29,7 +29,6 @@ Requires-Dist: pyyaml (>=6.0)
29
29
  Requires-Dist: questionary (>=2.0.1)
30
30
  Requires-Dist: rdkit-pypi (>=2022.9.5) ; extra == "full"
31
31
  Requires-Dist: requests (>=2.31.0)
32
- Requires-Dist: seaborn
33
32
  Requires-Dist: sentencepiece (>=0.2.0) ; extra == "embedders"
34
33
  Requires-Dist: sentencepiece (>=0.2.0) ; extra == "full"
35
34
  Requires-Dist: sqlalchemy (>=2.0.40,<3.0.0) ; extra == "full"
@@ -12,7 +12,7 @@ dayhoff_tools/cli/engine/shared.py,sha256=Ecx6I1jtzmxQDn3BezKpgpQ4SJeZf4SZjUCLg-
12
12
  dayhoff_tools/cli/engine/studio_commands.py,sha256=VwTQujz32-uMcYusDRE73SdzRpgvIkv7ZAF4zRv6AzA,30266
13
13
  dayhoff_tools/cli/main.py,sha256=Ii5boey--93yGthB_eS2LC7ZR3WHGsJXDHY7uElEtso,6169
14
14
  dayhoff_tools/cli/swarm_commands.py,sha256=5EyKj8yietvT5lfoz8Zx0iQvVaNgc3SJX1z2zQR6o6M,5614
15
- dayhoff_tools/cli/utility_commands.py,sha256=tU6fv8wnchxj8xuBR6lXI1_3tpyxcDxzqO7zyBXAfoY,44012
15
+ dayhoff_tools/cli/utility_commands.py,sha256=iMj2Oj6Q9LcUTwwZismFqc2QTW_oSeIDR1o_eC7kj-Q,50331
16
16
  dayhoff_tools/deployment/base.py,sha256=48KE76QlWMeIZJefcBOZVbyChS2V_mgs7IQ31odPV2o,17806
17
17
  dayhoff_tools/deployment/deploy_aws.py,sha256=gfqh09hGbz0q3oPqVm0imd_CEjKF2k8moGNRIL26qqE,18614
18
18
  dayhoff_tools/deployment/deploy_gcp.py,sha256=xgaOVsUDmP6wSEMYNkm1yRNcVskfdz80qJtCulkBIAM,8860
@@ -33,7 +33,7 @@ dayhoff_tools/intake/uniprot.py,sha256=BZYJQF63OtPcBBnQ7_P9gulxzJtqyorgyuDiPeOJq
33
33
  dayhoff_tools/logs.py,sha256=DKdeP0k0kliRcilwvX0mUB2eipO5BdWUeHwh-VnsICs,838
34
34
  dayhoff_tools/sqlite.py,sha256=jV55ikF8VpTfeQqqlHSbY8OgfyfHj8zgHNpZjBLos_E,18672
35
35
  dayhoff_tools/warehouse.py,sha256=UETBtZD3r7WgvURqfGbyHlT7cxoiVq8isjzMuerKw8I,24475
36
- dayhoff_tools-1.11.6.dist-info/METADATA,sha256=4z45zpr5kaL-2WFPAxStOG5hpgm_23EgsyDWW_rUt58,3003
37
- dayhoff_tools-1.11.6.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
38
- dayhoff_tools-1.11.6.dist-info/entry_points.txt,sha256=iAf4jteNqW3cJm6CO6czLxjW3vxYKsyGLZ8WGmxamSc,49
39
- dayhoff_tools-1.11.6.dist-info/RECORD,,
36
+ dayhoff_tools-1.11.8.dist-info/METADATA,sha256=BVSPi89Q4l1JH1DPOXHcwbxq9U1jJ66KJCaqsz5Sqrg,2980
37
+ dayhoff_tools-1.11.8.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
38
+ dayhoff_tools-1.11.8.dist-info/entry_points.txt,sha256=iAf4jteNqW3cJm6CO6czLxjW3vxYKsyGLZ8WGmxamSc,49
39
+ dayhoff_tools-1.11.8.dist-info/RECORD,,