dayhoff-tools 1.11.7__tar.gz → 1.11.9__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 (38) hide show
  1. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/PKG-INFO +2 -2
  2. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/dayhoff_tools/cli/utility_commands.py +118 -5
  3. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/pyproject.toml +2 -2
  4. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/README.md +0 -0
  5. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/dayhoff_tools/__init__.py +0 -0
  6. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/dayhoff_tools/chemistry/standardizer.py +0 -0
  7. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/dayhoff_tools/chemistry/utils.py +0 -0
  8. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/dayhoff_tools/cli/__init__.py +0 -0
  9. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/dayhoff_tools/cli/cloud_commands.py +0 -0
  10. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/dayhoff_tools/cli/engine/__init__.py +0 -0
  11. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/dayhoff_tools/cli/engine/engine_core.py +0 -0
  12. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/dayhoff_tools/cli/engine/engine_lifecycle.py +0 -0
  13. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/dayhoff_tools/cli/engine/engine_maintenance.py +0 -0
  14. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/dayhoff_tools/cli/engine/engine_management.py +0 -0
  15. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/dayhoff_tools/cli/engine/shared.py +0 -0
  16. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/dayhoff_tools/cli/engine/studio_commands.py +0 -0
  17. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/dayhoff_tools/cli/main.py +0 -0
  18. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/dayhoff_tools/cli/swarm_commands.py +0 -0
  19. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/dayhoff_tools/deployment/base.py +0 -0
  20. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/dayhoff_tools/deployment/deploy_aws.py +0 -0
  21. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/dayhoff_tools/deployment/deploy_gcp.py +0 -0
  22. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/dayhoff_tools/deployment/deploy_utils.py +0 -0
  23. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/dayhoff_tools/deployment/job_runner.py +0 -0
  24. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/dayhoff_tools/deployment/processors.py +0 -0
  25. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/dayhoff_tools/deployment/swarm.py +0 -0
  26. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/dayhoff_tools/embedders.py +0 -0
  27. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/dayhoff_tools/fasta.py +0 -0
  28. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/dayhoff_tools/file_ops.py +0 -0
  29. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/dayhoff_tools/h5.py +0 -0
  30. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/dayhoff_tools/intake/gcp.py +0 -0
  31. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/dayhoff_tools/intake/gtdb.py +0 -0
  32. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/dayhoff_tools/intake/kegg.py +0 -0
  33. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/dayhoff_tools/intake/mmseqs.py +0 -0
  34. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/dayhoff_tools/intake/structure.py +0 -0
  35. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/dayhoff_tools/intake/uniprot.py +0 -0
  36. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/dayhoff_tools/logs.py +0 -0
  37. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/dayhoff_tools/sqlite.py +0 -0
  38. {dayhoff_tools-1.11.7 → dayhoff_tools-1.11.9}/dayhoff_tools/warehouse.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dayhoff-tools
3
- Version: 1.11.7
3
+ Version: 1.11.9
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,7 @@ 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
32
+ Requires-Dist: seaborn (>=0.13.2)
33
33
  Requires-Dist: sentencepiece (>=0.2.0) ; extra == "embedders"
34
34
  Requires-Dist: sentencepiece (>=0.2.0) ; extra == "full"
35
35
  Requires-Dist: sqlalchemy (>=2.0.40,<3.0.0) ; extra == "full"
@@ -724,6 +724,64 @@ def _get_all_platform_manifests():
724
724
  return manifest_files
725
725
 
726
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
+
727
785
  def _update_all_manifests_for_dayhoff_tools(new_version: str):
728
786
  """Update dayhoff-tools constraint in all platform manifests."""
729
787
  import re
@@ -800,8 +858,11 @@ def add_dependency(
800
858
  section_name = "dev dependencies" if dev else "main dependencies"
801
859
  print(f"Adding '{package}' to {section_name} in all platform manifests...")
802
860
 
803
- # Parse package name to check for duplicates
861
+ # Parse package name to check for duplicates and version specs
804
862
  package_name = re.split(r"[<>=~!\[]", package)[0].strip()
863
+ has_version_spec = any(c in package for c in ["<", ">", "=", "~", "!"])
864
+
865
+ added_count = 0
805
866
 
806
867
  for manifest_file in manifest_files:
807
868
  try:
@@ -880,11 +941,61 @@ def add_dependency(
880
941
 
881
942
  manifest_file.write_text(new_content)
882
943
  print(f"✅ Added '{package}' to {manifest_file}")
944
+ added_count += 1
883
945
 
884
946
  except Exception as e:
885
947
  print(f"Error updating {manifest_file}: {e}")
886
948
 
887
- print(f"\n✅ Added '{package}' to all platform manifests")
949
+ # If nothing was added, exit early
950
+ if added_count == 0:
951
+ print(f"\n⚠️ Package '{package_name}' already exists in all manifests")
952
+ return
953
+
954
+ print(f"\n✅ Added '{package}' to {added_count} platform manifest(s)")
955
+
956
+ # If no version specified, resolve and add version constraint
957
+ if not has_version_spec:
958
+ print(f"\n🔍 Resolving version for '{package_name}'...")
959
+ resolved_version = _resolve_package_version(package_name)
960
+
961
+ if resolved_version:
962
+ print(f"📌 Resolved to version {resolved_version}")
963
+ print(
964
+ f"Updating manifests with version constraint '>={resolved_version}'..."
965
+ )
966
+
967
+ # Update all manifests to add version constraint
968
+ for manifest_file in manifest_files:
969
+ try:
970
+ content = manifest_file.read_text()
971
+ # Replace unversioned package with versioned one
972
+ pattern = re.compile(
973
+ rf'^(\s*["\']){re.escape(package_name)}(["\'],?)(.*)$',
974
+ re.MULTILINE,
975
+ )
976
+
977
+ def replace_with_version(match):
978
+ prefix = match.group(1)
979
+ suffix = match.group(2)
980
+ rest = match.group(3)
981
+ return (
982
+ f"{prefix}{package_name}>={resolved_version}{suffix}{rest}"
983
+ )
984
+
985
+ new_content = pattern.sub(replace_with_version, content)
986
+ manifest_file.write_text(new_content)
987
+ print(f"✅ Updated {manifest_file} with version constraint")
988
+ except Exception as e:
989
+ print(f"Warning: Could not update version in {manifest_file}: {e}")
990
+
991
+ print(
992
+ f"\n✅ Added '{package_name}>={resolved_version}' to {added_count} platform manifest(s)"
993
+ )
994
+ else:
995
+ print(
996
+ f"⚠️ Could not resolve version for '{package_name}', left unversioned"
997
+ )
998
+
888
999
  print(
889
1000
  f"\nRun {BLUE}dh tomlsync{RESET} to install the new dependency in your environment."
890
1001
  )
@@ -928,17 +1039,19 @@ def remove_dependency(
928
1039
  content = manifest_file.read_text()
929
1040
 
930
1041
  # Pattern to match the dependency line (with optional version spec)
931
- # Matches: "package...", or "package...",\n
1042
+ # Matches: "package...", or "package...",\n (including the newline)
932
1043
  pattern = re.compile(
933
- rf'^\s*["\']({package_esc}[<>=~!\[].+?|{package_esc})["\'],?\s*(?:#.*)?$',
1044
+ rf'^\s*["\']({package_esc}[<>=~!\[].+?|{package_esc})["\'],?\s*(?:#.*)?$\n?',
934
1045
  re.MULTILINE,
935
1046
  )
936
1047
 
937
1048
  new_content, num_removed = pattern.subn("", content)
938
1049
 
939
1050
  if num_removed > 0:
940
- # Clean up any double blank lines
1051
+ # Clean up any consecutive blank lines (more than one)
941
1052
  new_content = re.sub(r"\n\n\n+", "\n\n", new_content)
1053
+ # Also clean up trailing whitespace on lines
1054
+ new_content = re.sub(r"[ \t]+$", "", new_content, flags=re.MULTILINE)
942
1055
  manifest_file.write_text(new_content)
943
1056
  print(f"✅ Removed '{package}' from {manifest_file}")
944
1057
  removed_count += 1
@@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api"
5
5
 
6
6
  [project]
7
7
  name = "dayhoff-tools"
8
- version = "1.11.7"
8
+ version = "1.11.9"
9
9
  description = "Common tools for all the repos at Dayhoff Labs"
10
10
  authors = [
11
11
  {name = "Daniel Martin-Alarcon", email = "dma@dayhofflabs.com"}
@@ -21,7 +21,7 @@ dependencies = [
21
21
  "questionary>=2.0.1",
22
22
  "tzdata>=2025.2",
23
23
  "boto3>=1.36.8",
24
- "seaborn",
24
+ "seaborn>=0.13.2",
25
25
  ]
26
26
  requires-python = ">=3.10,<4.0"
27
27
 
File without changes