dayhoff-tools 1.0.17__tar.gz → 1.0.19__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 (30) hide show
  1. {dayhoff_tools-1.0.17 → dayhoff_tools-1.0.19}/PKG-INFO +17 -14
  2. {dayhoff_tools-1.0.17 → dayhoff_tools-1.0.19}/dayhoff_tools/cli/utility_commands.py +136 -25
  3. {dayhoff_tools-1.0.17 → dayhoff_tools-1.0.19}/pyproject.toml +26 -11
  4. {dayhoff_tools-1.0.17 → dayhoff_tools-1.0.19}/README.md +0 -0
  5. {dayhoff_tools-1.0.17 → dayhoff_tools-1.0.19}/dayhoff_tools/__init__.py +0 -0
  6. {dayhoff_tools-1.0.17 → dayhoff_tools-1.0.19}/dayhoff_tools/chemistry/standardizer.py +0 -0
  7. {dayhoff_tools-1.0.17 → dayhoff_tools-1.0.19}/dayhoff_tools/chemistry/utils.py +0 -0
  8. {dayhoff_tools-1.0.17 → dayhoff_tools-1.0.19}/dayhoff_tools/cli/__init__.py +0 -0
  9. {dayhoff_tools-1.0.17 → dayhoff_tools-1.0.19}/dayhoff_tools/cli/cloud_commands.py +0 -0
  10. {dayhoff_tools-1.0.17 → dayhoff_tools-1.0.19}/dayhoff_tools/cli/main.py +0 -0
  11. {dayhoff_tools-1.0.17 → dayhoff_tools-1.0.19}/dayhoff_tools/cli/swarm_commands.py +0 -0
  12. {dayhoff_tools-1.0.17 → dayhoff_tools-1.0.19}/dayhoff_tools/deployment/base.py +0 -0
  13. {dayhoff_tools-1.0.17 → dayhoff_tools-1.0.19}/dayhoff_tools/deployment/deploy_aws.py +0 -0
  14. {dayhoff_tools-1.0.17 → dayhoff_tools-1.0.19}/dayhoff_tools/deployment/deploy_gcp.py +0 -0
  15. {dayhoff_tools-1.0.17 → dayhoff_tools-1.0.19}/dayhoff_tools/deployment/deploy_utils.py +0 -0
  16. {dayhoff_tools-1.0.17 → dayhoff_tools-1.0.19}/dayhoff_tools/deployment/job_runner.py +0 -0
  17. {dayhoff_tools-1.0.17 → dayhoff_tools-1.0.19}/dayhoff_tools/deployment/processors.py +0 -0
  18. {dayhoff_tools-1.0.17 → dayhoff_tools-1.0.19}/dayhoff_tools/deployment/swarm.py +0 -0
  19. {dayhoff_tools-1.0.17 → dayhoff_tools-1.0.19}/dayhoff_tools/embedders.py +0 -0
  20. {dayhoff_tools-1.0.17 → dayhoff_tools-1.0.19}/dayhoff_tools/fasta.py +0 -0
  21. {dayhoff_tools-1.0.17 → dayhoff_tools-1.0.19}/dayhoff_tools/file_ops.py +0 -0
  22. {dayhoff_tools-1.0.17 → dayhoff_tools-1.0.19}/dayhoff_tools/gcp.py +0 -0
  23. {dayhoff_tools-1.0.17 → dayhoff_tools-1.0.19}/dayhoff_tools/h5.py +0 -0
  24. {dayhoff_tools-1.0.17 → dayhoff_tools-1.0.19}/dayhoff_tools/kegg.py +0 -0
  25. {dayhoff_tools-1.0.17 → dayhoff_tools-1.0.19}/dayhoff_tools/logs.py +0 -0
  26. {dayhoff_tools-1.0.17 → dayhoff_tools-1.0.19}/dayhoff_tools/mmseqs.py +0 -0
  27. {dayhoff_tools-1.0.17 → dayhoff_tools-1.0.19}/dayhoff_tools/sqlite.py +0 -0
  28. {dayhoff_tools-1.0.17 → dayhoff_tools-1.0.19}/dayhoff_tools/structure.py +0 -0
  29. {dayhoff_tools-1.0.17 → dayhoff_tools-1.0.19}/dayhoff_tools/uniprot.py +0 -0
  30. {dayhoff_tools-1.0.17 → dayhoff_tools-1.0.19}/dayhoff_tools/warehouse.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: dayhoff-tools
3
- Version: 1.0.17
3
+ Version: 1.0.19
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
@@ -10,23 +10,26 @@ Classifier: Programming Language :: Python :: 3.10
10
10
  Classifier: Programming Language :: Python :: 3.11
11
11
  Classifier: Programming Language :: Python :: 3.12
12
12
  Classifier: Programming Language :: Python :: 3.13
13
- Provides-Extra: full
14
- Requires-Dist: biopython (>=1.84) ; extra == "full"
15
- Requires-Dist: boto3 (>=1.36.8) ; extra == "full"
16
- Requires-Dist: docker (>=7.1.0) ; extra == "full"
17
- Requires-Dist: fair-esm (>=2.0.0) ; extra == "full"
13
+ Provides-Extra: lite
14
+ Requires-Dist: biopython (>=1.84)
15
+ Requires-Dist: boto3 (>=1.36.8)
16
+ Requires-Dist: docker (>=7.1.0)
17
+ Requires-Dist: fair-esm (>=2.0.0)
18
18
  Requires-Dist: firebase-admin (>=6.5.0)
19
- Requires-Dist: h5py (>=3.11.0) ; extra == "full"
20
- Requires-Dist: pandas (>=2.2.3) ; extra == "full"
19
+ Requires-Dist: firebase-admin (>=6.5.0) ; extra == "lite"
20
+ Requires-Dist: h5py (>=3.11.0)
21
+ Requires-Dist: pandas (>=2.2.3)
21
22
  Requires-Dist: pyyaml (>=6.0)
22
- Requires-Dist: questionary (>=2.0.1) ; extra == "full"
23
- Requires-Dist: rdkit-pypi (>=2022.9.5) ; extra == "full"
23
+ Requires-Dist: pyyaml (>=6.0) ; extra == "lite"
24
+ Requires-Dist: questionary (>=2.0.1)
25
+ Requires-Dist: rdkit-pypi (>=2022.9.5)
24
26
  Requires-Dist: requests (>=2.31.0)
25
- Requires-Dist: sqlalchemy (>=2.0.40,<3.0.0) ; extra == "full"
26
- Requires-Dist: torch (>=2.1.0) ; extra == "full"
27
- Requires-Dist: torchvision (>=0.16.0) ; extra == "full"
28
- Requires-Dist: transformers (==4.36.2) ; extra == "full"
27
+ Requires-Dist: requests (>=2.31.0) ; extra == "lite"
28
+ Requires-Dist: sqlalchemy (>=2.0.40,<3.0.0)
29
+ Requires-Dist: toml (>=0.10)
30
+ Requires-Dist: transformers (==4.36.2)
29
31
  Requires-Dist: typer (>=0.9.0)
32
+ Requires-Dist: typer (>=0.9.0) ; extra == "lite"
30
33
  Description-Content-Type: text/markdown
31
34
 
32
35
  # dayhoff-tools
@@ -7,6 +7,8 @@ import subprocess
7
7
  import sys
8
8
  from pathlib import Path
9
9
 
10
+ import toml
11
+ import typer
10
12
  import yaml
11
13
 
12
14
 
@@ -200,6 +202,10 @@ def build_and_upload_wheel(bump_part: str = "patch"):
200
202
  )
201
203
  return
202
204
 
205
+ # ANSI color codes
206
+ BLUE = "\033[94m"
207
+ RESET = "\033[0m"
208
+
203
209
  # --- Authentication Setup ---
204
210
  token = os.environ.get("UV_PUBLISH_TOKEN")
205
211
 
@@ -211,6 +217,8 @@ def build_and_upload_wheel(bump_part: str = "patch"):
211
217
  return
212
218
 
213
219
  # Build the command with token authentication
220
+ # IMPORTANT: Mask token for printing
221
+ publish_cmd_safe_print = ["uv", "publish", "--token", "*****"]
214
222
  publish_cmd = ["uv", "publish", "--token", token]
215
223
  print("Using UV_PUBLISH_TOKEN for authentication.")
216
224
 
@@ -279,13 +287,16 @@ def build_and_upload_wheel(bump_part: str = "patch"):
279
287
  # --- End Version Bumping Logic ---
280
288
 
281
289
  # Build wheel and sdist
282
- print("Building wheel and sdist using uv build...")
283
- subprocess.run(["uv", "build"], check=True)
290
+ build_cmd = ["uv", "build"]
291
+ # Print command in blue
292
+ print(f"Running command: {BLUE}{' '.join(build_cmd)}{RESET}")
293
+ subprocess.run(build_cmd, check=True)
284
294
 
285
295
  # Upload using uv publish with explicit arguments
286
- print("Uploading to PyPI using uv publish...")
296
+ # Print masked command in blue
297
+ print(f"Running command: {BLUE}{' '.join(publish_cmd_safe_print)}{RESET}")
287
298
  subprocess.run(
288
- publish_cmd, # Use the command list built earlier
299
+ publish_cmd, # Use the actual command with token
289
300
  check=True,
290
301
  )
291
302
 
@@ -355,40 +366,140 @@ def build_and_upload_wheel(bump_part: str = "patch"):
355
366
 
356
367
 
357
368
  def update_dayhoff_tools():
358
- """Update the dayhoff-tools package to the latest version using uv.
369
+ """Update dayhoff-tools to latest, update pyproject.toml, and sync.
359
370
 
360
- Runs `uv add dayhoff-tools@latest`. Note: This command might not correctly
361
- update dayhoff-tools if it's only listed in a top-level [dependency-groups]
362
- table in the target project's pyproject.toml. It works best for dependencies
363
- in [project.dependencies] or [project.optional-dependencies].
371
+ 1. Runs `uv lock --upgrade-package dayhoff-tools`
372
+ 2. Parses uv.lock to find the new version.
373
+ 3. Updates the version constraint in pyproject.toml to `>=<new_version>`.
374
+ 4. Runs `uv sync --no-install-project`.
364
375
  """
376
+ # ANSI color codes
377
+ BLUE = "\033[94m"
378
+ RESET = "\033[0m"
379
+
380
+ lock_file_path = Path("uv.lock")
381
+ pyproject_path = Path("pyproject.toml")
382
+
365
383
  try:
366
- print("Attempting to update dayhoff-tools to the latest version using uv...")
367
- # Reverted to simple uv add, acknowledging limitations with top-level groups
368
- subprocess.run(["uv", "add", "dayhoff-tools@latest"], check=True)
369
- print("Update attempt complete! Check pyproject.toml and run sync if needed.")
384
+ print("Updating dayhoff-tools lock...")
385
+
386
+ # Step 1: Update lock file for dayhoff-tools
387
+ lock_cmd = ["uv", "lock", "--upgrade-package", "dayhoff-tools"]
388
+ print(f"Running command: {BLUE}{' '.join(lock_cmd)}{RESET}")
389
+ subprocess.run(lock_cmd, check=True)
390
+
391
+ # Step 2: Parse uv.lock to find the new version
392
+ print(f"Reading {lock_file_path} to find new version...")
393
+ if not lock_file_path.exists():
394
+ print(f"Error: {lock_file_path} not found after lock command.")
395
+ return
396
+
397
+ locked_version = None
398
+ try:
399
+ lock_data = toml.load(lock_file_path)
400
+ # Find dayhoff-tools in the lock file packages
401
+ for package in lock_data.get("package", []):
402
+ if package.get("name") == "dayhoff-tools":
403
+ locked_version = package.get("version")
404
+ break
405
+ except toml.TomlDecodeError as e:
406
+ print(f"Error parsing {lock_file_path}: {e}")
407
+ return
408
+ except Exception as e:
409
+ print(f"Error reading lock file: {e}")
410
+ return
411
+
412
+ if not locked_version:
413
+ print(f"Error: Could not find dayhoff-tools version in {lock_file_path}.")
414
+ return
415
+
416
+ print(f"Found dayhoff-tools version {locked_version} in lock file.")
417
+
418
+ # Step 3: Update pyproject.toml
419
+ print(f"Updating {pyproject_path} version constraint...")
420
+ try:
421
+ content = pyproject_path.read_text()
422
+ # Regex to find the dayhoff-tools dependency line, capturing name+extra
423
+ # Matches 'dayhoff-tools' or \"dayhoff-tools\", optional [extra], >= constraints etc.
424
+ pattern = re.compile(
425
+ r"(^[\'\"](dayhoff-tools(?:\[[^\\\]]+\\])?)[\'\"]\s*)[\\>\\<\\=\\~\\^\\(\\)\\s,0-9\\.\\*\'\"]+",
426
+ re.MULTILINE,
427
+ )
428
+ new_constraint = f">= {locked_version}"
429
+ new_content, num_replacements = pattern.subn(
430
+ rf"\1{new_constraint}", content
431
+ )
432
+
433
+ if num_replacements > 0:
434
+ pyproject_path.write_text(new_content)
435
+ print(
436
+ f"Updated dayhoff-tools constraint in {pyproject_path} to '{new_constraint}'"
437
+ )
438
+ else:
439
+ print(
440
+ f"Warning: Could not find dayhoff-tools dependency line in {pyproject_path} to update constraint."
441
+ )
442
+
443
+ except FileNotFoundError:
444
+ print(f"Error: {pyproject_path} not found.")
445
+ return
446
+ except Exception as e:
447
+ print(f"Error updating {pyproject_path}: {e}")
448
+ # Continue to sync step even if pyproject update fails?
449
+ # For now, let's proceed to sync.
450
+ print("Proceeding with sync despite pyproject.toml update error.")
451
+
452
+ # Step 4: Sync environment based on updated lock file
453
+ print("Syncing environment...")
454
+ sync_cmd = ["uv", "sync", "--no-install-project"]
455
+ print(f"Running command: {BLUE}{' '.join(sync_cmd)}{RESET}")
456
+ subprocess.run(sync_cmd, check=True)
457
+
458
+ print(
459
+ "dayhoff-tools updated, pyproject.toml modified, and environment synced successfully."
460
+ )
461
+
370
462
  except subprocess.CalledProcessError as e:
371
- print(f"Error occurred while attempting update: {e}")
463
+ print(f"Error occurred during update/sync process: {e}")
372
464
  except FileNotFoundError:
465
+ # This catches if uv command itself is not found
373
466
  print("Error: 'uv' command not found. Is uv installed and in PATH?")
374
467
  sys.exit(1)
468
+ except Exception as e:
469
+ # Catch any other unexpected errors
470
+ print(f"An unexpected error occurred: {e}")
375
471
 
376
472
 
377
- def sync_dependencies():
473
+ def sync_dependencies(
474
+ install_project: bool = typer.Option(
475
+ False,
476
+ "--install-project",
477
+ help="Install the local project package itself into the environment.",
478
+ )
479
+ ):
378
480
  """Update uv.lock and sync dependencies based on pyproject.toml.
379
481
 
380
- Runs `uv lock` followed by `uv sync --all-groups --no-install-project`.
381
- This ensures the lock file is up-to-date and installs all declared
382
- dependencies without building/installing the local project itself.
482
+ By default, installs all declared dependencies without building/installing
483
+ the local project itself (--no-install-project). Use --install-project to
484
+ include the local project.
383
485
  """
384
- try:
385
- print("Updating lock file (uv lock)...")
386
- subprocess.run(["uv", "lock"], check=True)
486
+ # ANSI color codes
487
+ BLUE = "\033[94m"
488
+ RESET = "\033[0m"
387
489
 
388
- print("Syncing dependencies (uv sync --all-groups --no-install-project)...")
389
- subprocess.run(
390
- ["uv", "sync", "--all-groups", "--no-install-project"], check=True
391
- )
490
+ try:
491
+ lock_cmd = ["uv", "lock"]
492
+ # Print command in blue
493
+ print(f"Running command: {BLUE}{' '.join(lock_cmd)}{RESET}")
494
+ subprocess.run(lock_cmd, check=True)
495
+
496
+ sync_cmd = ["uv", "sync", "--all-groups"]
497
+ if not install_project:
498
+ sync_cmd.append("--no-install-project")
499
+
500
+ # Print command in blue
501
+ print(f"Running command: {BLUE}{' '.join(sync_cmd)}{RESET}")
502
+ subprocess.run(sync_cmd, check=True)
392
503
 
393
504
  print("Dependencies synced successfully.")
394
505
  except subprocess.CalledProcessError as e:
@@ -4,24 +4,20 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [project]
6
6
  name = "dayhoff-tools"
7
- version = "1.0.17"
7
+ version = "1.0.19"
8
8
  description = "Common tools for all the repos at Dayhoff Labs"
9
9
  authors = [
10
10
  {name = "Daniel Martin-Alarcon", email = "dma@dayhofflabs.com"}
11
11
  ]
12
12
  readme = "README.md"
13
- # Just enough deps to use the job_runner
13
+
14
+ # Default dependencies now include the formerly "full" set + base set
14
15
  dependencies = [
15
16
  "firebase-admin>=6.5.0",
16
17
  "pyyaml>=6.0",
17
18
  "requests>=2.31.0",
18
19
  "typer>=0.9.0",
19
- ]
20
- requires-python = ">=3.10,<4.0"
21
-
22
- [project.optional-dependencies]
23
- # Deps we expect to need to bring to new repos
24
- full = [
20
+ "toml>=0.10",
25
21
  "biopython>=1.84",
26
22
  "boto3>=1.36.8",
27
23
  "docker>=7.1.0",
@@ -32,12 +28,29 @@ full = [
32
28
  "rdkit-pypi>=2022.9.5",
33
29
  "sqlalchemy (>=2.0.40,<3.0.0)",
34
30
  "transformers==4.36.2",
35
- "torch>=2.1.0",
36
- "torchvision>=0.16.0",
37
31
  ]
32
+ requires-python = ">=3.10,<4.0"
33
+
34
+ [project.optional-dependencies]
35
+ lite = [
36
+ "firebase-admin>=6.5.0",
37
+ "pyyaml>=6.0",
38
+ "requests>=2.31.0",
39
+ "typer>=0.9.0",
40
+ ]
41
+
42
+ # Added UV-specific configuration for PyTorch source (for dev/test env)
43
+ [[tool.uv.index]]
44
+ name = "torch-cuda"
45
+ url = "https://download.pytorch.org/whl/cu121"
46
+ explicit = true
47
+
48
+ [tool.uv.sources]
49
+ torch = { index = "torch-cuda" }
50
+ torchvision = { index = "torch-cuda" }
38
51
 
39
52
  [dependency-groups]
40
- common = [
53
+ dev = [
41
54
  "black>=25.1.0,<26",
42
55
  "boto3>=1.36.8",
43
56
  "colorlog>=6.8.2,<7",
@@ -57,6 +70,8 @@ common = [
57
70
  "pytest>=8.0.2,<9",
58
71
  "pytest-cov>=4.1.0,<5",
59
72
  "pytest-mock>=3.12.0,<4",
73
+ "torch==2.4.0+cu121",
74
+ "torchvision==0.19.0+cu121",
60
75
  ]
61
76
 
62
77
  [project.scripts]
File without changes