dayhoff-tools 1.0.18__py3-none-any.whl → 1.0.19__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.
@@ -7,6 +7,7 @@ import subprocess
7
7
  import sys
8
8
  from pathlib import Path
9
9
 
10
+ import toml
10
11
  import typer
11
12
  import yaml
12
13
 
@@ -201,6 +202,10 @@ def build_and_upload_wheel(bump_part: str = "patch"):
201
202
  )
202
203
  return
203
204
 
205
+ # ANSI color codes
206
+ BLUE = "\033[94m"
207
+ RESET = "\033[0m"
208
+
204
209
  # --- Authentication Setup ---
205
210
  token = os.environ.get("UV_PUBLISH_TOKEN")
206
211
 
@@ -283,13 +288,13 @@ def build_and_upload_wheel(bump_part: str = "patch"):
283
288
 
284
289
  # Build wheel and sdist
285
290
  build_cmd = ["uv", "build"]
286
- print(f"Running command: {' '.join(build_cmd)}")
291
+ # Print command in blue
292
+ print(f"Running command: {BLUE}{' '.join(build_cmd)}{RESET}")
287
293
  subprocess.run(build_cmd, check=True)
288
294
 
289
295
  # Upload using uv publish with explicit arguments
290
- print(
291
- f"Running command: {' '.join(publish_cmd_safe_print)}"
292
- ) # Print masked command
296
+ # Print masked command in blue
297
+ print(f"Running command: {BLUE}{' '.join(publish_cmd_safe_print)}{RESET}")
293
298
  subprocess.run(
294
299
  publish_cmd, # Use the actual command with token
295
300
  check=True,
@@ -361,24 +366,108 @@ def build_and_upload_wheel(bump_part: str = "patch"):
361
366
 
362
367
 
363
368
  def update_dayhoff_tools():
364
- """Update the dayhoff-tools package to the latest version using uv.
369
+ """Update dayhoff-tools to latest, update pyproject.toml, and sync.
365
370
 
366
- Runs `uv add dayhoff-tools@latest`. Note: This command might not correctly
367
- update dayhoff-tools if it's only listed in a top-level [dependency-groups]
368
- table in the target project's pyproject.toml. It works best for dependencies
369
- 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`.
370
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
+
371
383
  try:
372
- print("Attempting to update dayhoff-tools to the latest version using uv...")
373
- update_cmd = ["uv", "add", "dayhoff-tools@latest"]
374
- print(f"Running command: {' '.join(update_cmd)}")
375
- subprocess.run(update_cmd, check=True)
376
- 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
+
377
462
  except subprocess.CalledProcessError as e:
378
- print(f"Error occurred while attempting update: {e}")
463
+ print(f"Error occurred during update/sync process: {e}")
379
464
  except FileNotFoundError:
465
+ # This catches if uv command itself is not found
380
466
  print("Error: 'uv' command not found. Is uv installed and in PATH?")
381
467
  sys.exit(1)
468
+ except Exception as e:
469
+ # Catch any other unexpected errors
470
+ print(f"An unexpected error occurred: {e}")
382
471
 
383
472
 
384
473
  def sync_dependencies(
@@ -394,16 +483,22 @@ def sync_dependencies(
394
483
  the local project itself (--no-install-project). Use --install-project to
395
484
  include the local project.
396
485
  """
486
+ # ANSI color codes
487
+ BLUE = "\033[94m"
488
+ RESET = "\033[0m"
489
+
397
490
  try:
398
491
  lock_cmd = ["uv", "lock"]
399
- print(f"Running command: {' '.join(lock_cmd)}")
492
+ # Print command in blue
493
+ print(f"Running command: {BLUE}{' '.join(lock_cmd)}{RESET}")
400
494
  subprocess.run(lock_cmd, check=True)
401
495
 
402
496
  sync_cmd = ["uv", "sync", "--all-groups"]
403
497
  if not install_project:
404
498
  sync_cmd.append("--no-install-project")
405
499
 
406
- print(f"Running command: {' '.join(sync_cmd)}")
500
+ # Print command in blue
501
+ print(f"Running command: {BLUE}{' '.join(sync_cmd)}{RESET}")
407
502
  subprocess.run(sync_cmd, check=True)
408
503
 
409
504
  print("Dependencies synced successfully.")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: dayhoff-tools
3
- Version: 1.0.18
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,21 +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: base
13
+ Provides-Extra: lite
14
14
  Requires-Dist: biopython (>=1.84)
15
15
  Requires-Dist: boto3 (>=1.36.8)
16
16
  Requires-Dist: docker (>=7.1.0)
17
17
  Requires-Dist: fair-esm (>=2.0.0)
18
- Requires-Dist: firebase-admin (>=6.5.0) ; extra == "base"
18
+ Requires-Dist: firebase-admin (>=6.5.0)
19
+ Requires-Dist: firebase-admin (>=6.5.0) ; extra == "lite"
19
20
  Requires-Dist: h5py (>=3.11.0)
20
21
  Requires-Dist: pandas (>=2.2.3)
21
- Requires-Dist: pyyaml (>=6.0) ; extra == "base"
22
+ Requires-Dist: pyyaml (>=6.0)
23
+ Requires-Dist: pyyaml (>=6.0) ; extra == "lite"
22
24
  Requires-Dist: questionary (>=2.0.1)
23
25
  Requires-Dist: rdkit-pypi (>=2022.9.5)
24
- Requires-Dist: requests (>=2.31.0) ; extra == "base"
26
+ Requires-Dist: requests (>=2.31.0)
27
+ Requires-Dist: requests (>=2.31.0) ; extra == "lite"
25
28
  Requires-Dist: sqlalchemy (>=2.0.40,<3.0.0)
29
+ Requires-Dist: toml (>=0.10)
26
30
  Requires-Dist: transformers (==4.36.2)
27
- Requires-Dist: typer (>=0.9.0) ; extra == "base"
31
+ Requires-Dist: typer (>=0.9.0)
32
+ Requires-Dist: typer (>=0.9.0) ; extra == "lite"
28
33
  Description-Content-Type: text/markdown
29
34
 
30
35
  # dayhoff-tools
@@ -5,7 +5,7 @@ dayhoff_tools/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
5
5
  dayhoff_tools/cli/cloud_commands.py,sha256=KiYEuD3nSg8QPWBYfrhdze2La_CJe4iqK-8uOAHyS8U,35827
6
6
  dayhoff_tools/cli/main.py,sha256=yorL117hknzhNybt7CTz4oKXVuQRIDXPl7huIEWga-M,3666
7
7
  dayhoff_tools/cli/swarm_commands.py,sha256=5EyKj8yietvT5lfoz8Zx0iQvVaNgc3SJX1z2zQR6o6M,5614
8
- dayhoff_tools/cli/utility_commands.py,sha256=217qbmt4qVoaPwStvwONoAj9NP9k9UkExs5WyKNCQt8,15586
8
+ dayhoff_tools/cli/utility_commands.py,sha256=rbcrTsvdKivBEuVDhOFz3SoPJeLx9pCSj3XUmc6Q0lk,19044
9
9
  dayhoff_tools/deployment/base.py,sha256=u-AjbtHnFLoLt33dhYXHIpV-6jcieMEHHGBGN_U9Hm0,15626
10
10
  dayhoff_tools/deployment/deploy_aws.py,sha256=O0gQxHioSU_sNU8T8MD4wSOPvWc--V8eRRZzlRu035I,16446
11
11
  dayhoff_tools/deployment/deploy_gcp.py,sha256=DxBM4sUzwPK9RWLP9bSfr38n1HHl-TVrp4TsbdN8pUA,5795
@@ -25,7 +25,7 @@ dayhoff_tools/sqlite.py,sha256=jV55ikF8VpTfeQqqlHSbY8OgfyfHj8zgHNpZjBLos_E,18672
25
25
  dayhoff_tools/structure.py,sha256=ufN3gAodQxhnt7psK1VTQeu9rKERmo_PhoxIbB4QKMw,27660
26
26
  dayhoff_tools/uniprot.py,sha256=BZYJQF63OtPcBBnQ7_P9gulxzJtqyorgyuDiPeOJqE4,16456
27
27
  dayhoff_tools/warehouse.py,sha256=TqV8nex1AluNaL4JuXH5zuu9P7qmE89lSo6f_oViy6U,14965
28
- dayhoff_tools-1.0.18.dist-info/METADATA,sha256=lbn5KAcT-XrkbrPfcPL6mQQrK9PoP0BUyV2Kjv4SIDc,2049
29
- dayhoff_tools-1.0.18.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
30
- dayhoff_tools-1.0.18.dist-info/entry_points.txt,sha256=iAf4jteNqW3cJm6CO6czLxjW3vxYKsyGLZ8WGmxamSc,49
31
- dayhoff_tools-1.0.18.dist-info/RECORD,,
28
+ dayhoff_tools-1.0.19.dist-info/METADATA,sha256=okG1WGmODVeiTDHJtFIiuoJCMT1aCdnKZMiK2yLAB9o,2214
29
+ dayhoff_tools-1.0.19.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
30
+ dayhoff_tools-1.0.19.dist-info/entry_points.txt,sha256=iAf4jteNqW3cJm6CO6czLxjW3vxYKsyGLZ8WGmxamSc,49
31
+ dayhoff_tools-1.0.19.dist-info/RECORD,,