dayhoff-tools 1.1.0__py3-none-any.whl → 1.1.2__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
@@ -9,7 +9,6 @@ from dayhoff_tools.cli.utility_commands import (
9
9
  get_ancestry,
10
10
  import_from_warehouse_typer,
11
11
  install_dependencies,
12
- rebuild_devcontainer_file,
13
12
  test_github_actions_locally,
14
13
  update_dependencies,
15
14
  )
@@ -23,13 +22,12 @@ app.command("clean")(delete_local_branch)
23
22
  app.command(
24
23
  "install", help="Install dependencies based on pyproject.toml and sync environment."
25
24
  )(install_dependencies)
26
- app.command(
27
- "update", help="Update dependencies (--all or --dayhoff) and sync environment."
28
- )(update_dependencies)
25
+ app.command("update", help="Update dayhoff-tools (or all deps) and sync environment.")(
26
+ update_dependencies
27
+ )
29
28
 
30
29
  # Other Utilities
31
30
  app.command("gha")(test_github_actions_locally)
32
- app.command("rebuild")(rebuild_devcontainer_file)
33
31
  app.command("wadd")(add_to_warehouse_typer)
34
32
  app.command("wancestry")(get_ancestry)
35
33
  app.command("wimport")(import_from_warehouse_typer)
@@ -23,17 +23,6 @@ def test_github_actions_locally():
23
23
  print(f"Error occurred while running the script: {e}")
24
24
 
25
25
 
26
- def rebuild_devcontainer_file():
27
- """Run the script prepare_for_build.py."""
28
- script_path = ".devcontainer/scripts/prepare_for_build.py"
29
-
30
- try:
31
- subprocess.check_call([sys.executable, script_path])
32
- print("Script ran successfully!")
33
- except subprocess.CalledProcessError as e:
34
- print(f"Error occurred while running the script: {e}")
35
-
36
-
37
26
  def get_ancestry(filepath: str) -> None:
38
27
  """Take a .dvc file created from import, and generate an ancestry entry
39
28
  that can be manually copied into other .dvc files."""
@@ -421,28 +410,21 @@ def install_dependencies(
421
410
 
422
411
 
423
412
  def update_dependencies(
424
- update_dayhoff: bool = typer.Option(
425
- False,
426
- "--dayhoff",
427
- "-d",
428
- help="Update only the dayhoff-tools package to latest, update pyproject.toml, and sync.",
429
- ),
430
413
  update_all: bool = typer.Option(
431
414
  False,
432
415
  "--all",
433
416
  "-a",
434
- help="Update all dependencies to their latest compatible versions and sync.",
417
+ help="Update all dependencies instead of just dayhoff-tools.",
435
418
  ),
436
419
  ):
437
420
  """Update dependencies to newer versions.
438
421
 
439
- Requires specifying either --dayhoff/-d or --all/-a.
422
+ Default Action (no flags): Updates only 'dayhoff-tools' package to latest,
423
+ updates pyproject.toml, and syncs.
440
424
 
441
- Modes:
425
+ Flags:
442
426
  --all/-a: Updates all dependencies to latest compatible versions (`uv lock --upgrade`)
443
- and syncs the environment.
444
- --dayhoff/-d: Updates only 'dayhoff-tools' to latest, updates its constraint
445
- in pyproject.toml, and syncs the environment.
427
+ and syncs the environment. Overrides the default.
446
428
  """
447
429
  # ANSI color codes
448
430
  BLUE = "\033[94m"
@@ -451,28 +433,24 @@ def update_dependencies(
451
433
  lock_file_path = Path("uv.lock")
452
434
  pyproject_path = Path("pyproject.toml")
453
435
 
454
- # Validate that either -d or -a is provided
455
- if not update_dayhoff and not update_all:
456
- print(
457
- "Error: Must specify either --dayhoff (-d) or --all (-a) to update dependencies."
458
- )
459
- raise typer.Exit(code=1)
460
- if update_dayhoff and update_all:
461
- print("Error: Cannot specify both --dayhoff (-d) and --all (-a).")
462
- raise typer.Exit(code=1)
463
-
464
- # Determine lock command based on flags
436
+ # Determine action based on flags
465
437
  lock_cmd = ["uv", "lock"]
466
438
  action_description = ""
439
+ run_pyproject_update = False
467
440
 
468
- if update_dayhoff:
469
- lock_cmd.extend(["--upgrade-package", "dayhoff-tools"])
470
- action_description = "Updating dayhoff-tools lock and pyproject.toml..."
471
- elif update_all:
441
+ if update_all:
472
442
  lock_cmd.append("--upgrade")
473
443
  action_description = (
474
444
  "Updating lock file for all dependencies to latest versions..."
475
445
  )
446
+ else: # Default behavior: update dayhoff-tools
447
+ lock_cmd.extend(["--upgrade-package", "dayhoff-tools"])
448
+ action_description = (
449
+ "Updating dayhoff-tools lock and pyproject.toml (default behavior)..."
450
+ )
451
+ run_pyproject_update = (
452
+ True # Only update pyproject if we are doing the dayhoff update
453
+ )
476
454
 
477
455
  try:
478
456
  # Step 1: Run the update lock command
@@ -480,13 +458,12 @@ def update_dependencies(
480
458
  print(f"Running command: {BLUE}{' '.join(lock_cmd)}{RESET}")
481
459
  subprocess.run(lock_cmd, check=True, capture_output=True)
482
460
 
483
- # Step 2: If specifically updating dayhoff-tools, update pyproject.toml
484
- if update_dayhoff:
461
+ # Step 2: Update pyproject.toml only if doing the dayhoff update (default)
462
+ if run_pyproject_update:
485
463
  print(f"Reading {lock_file_path} to find new dayhoff-tools version...")
486
464
  if not lock_file_path.exists():
487
465
  print(f"Error: {lock_file_path} not found after lock command.")
488
- return # Changed to return instead of exit
489
-
466
+ return
490
467
  locked_version = None
491
468
  try:
492
469
  lock_data = toml.load(lock_file_path)
@@ -496,20 +473,18 @@ def update_dependencies(
496
473
  break
497
474
  except toml.TomlDecodeError as e:
498
475
  print(f"Error parsing {lock_file_path}: {e}")
499
- return # Changed to return
476
+ return
500
477
  except Exception as e:
501
478
  print(f"Error reading lock file: {e}")
502
- return # Changed to return
479
+ return
503
480
 
504
481
  if not locked_version:
505
482
  print(
506
483
  f"Error: Could not find dayhoff-tools version in {lock_file_path}."
507
484
  )
508
- return # Changed to return
485
+ return
509
486
 
510
487
  print(f"Found dayhoff-tools version {locked_version} in lock file.")
511
-
512
- # Update pyproject.toml constraint
513
488
  print(f"Updating {pyproject_path} version constraint...")
514
489
  try:
515
490
  content = pyproject_path.read_text()
@@ -523,7 +498,6 @@ def update_dependencies(
523
498
  new_content, num_replacements = pattern.subn(
524
499
  replacement_string, content
525
500
  )
526
-
527
501
  if num_replacements > 0:
528
502
  pyproject_path.write_text(new_content)
529
503
  print(
@@ -535,7 +509,7 @@ def update_dependencies(
535
509
  )
536
510
  except FileNotFoundError:
537
511
  print(f"Error: {pyproject_path} not found.")
538
- return # Changed to return
512
+ return
539
513
  except Exception as e:
540
514
  print(f"Error updating {pyproject_path}: {e}")
541
515
  print("Proceeding with sync despite pyproject.toml update error.")
@@ -548,12 +522,12 @@ def update_dependencies(
548
522
  subprocess.run(sync_cmd, check=True)
549
523
 
550
524
  # Final status message
551
- if update_dayhoff:
525
+ if update_all:
526
+ print("All dependencies updated and environment synced successfully.")
527
+ else: # Default case (dayhoff update)
552
528
  print(
553
529
  "dayhoff-tools updated, pyproject.toml modified, and environment synced successfully."
554
530
  )
555
- elif update_all:
556
- print("All dependencies updated and environment synced successfully.")
557
531
 
558
532
  except subprocess.CalledProcessError as e:
559
533
  stderr_output = e.stderr.decode() if e.stderr else "No stderr output."
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: dayhoff-tools
3
- Version: 1.1.0
3
+ Version: 1.1.2
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
@@ -3,9 +3,9 @@ dayhoff_tools/chemistry/standardizer.py,sha256=uMn7VwHnx02nc404eO6fRuS4rsl4dvSPf
3
3
  dayhoff_tools/chemistry/utils.py,sha256=jt-7JgF-GeeVC421acX-bobKbLU_X94KNOW24p_P-_M,2257
4
4
  dayhoff_tools/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  dayhoff_tools/cli/cloud_commands.py,sha256=KiYEuD3nSg8QPWBYfrhdze2La_CJe4iqK-8uOAHyS8U,35827
6
- dayhoff_tools/cli/main.py,sha256=O-kPX0Di3_W0yBd-jSzQrOKm4K3deV_-jQhOom6Ir5g,3875
6
+ dayhoff_tools/cli/main.py,sha256=Ae0Bee2VjRzUge1I2DJoDVqoXpQnKfxGhdiMSmIWJwo,3788
7
7
  dayhoff_tools/cli/swarm_commands.py,sha256=5EyKj8yietvT5lfoz8Zx0iQvVaNgc3SJX1z2zQR6o6M,5614
8
- dayhoff_tools/cli/utility_commands.py,sha256=cpxAVYeSnDJXKhxWJ75X8N1VP6qNLl0TrdYY6BBv1xw,21776
8
+ dayhoff_tools/cli/utility_commands.py,sha256=fauEY2M9NyoW5XeU4wyEw8t5PZlSLx5b9kIRXJ4WGNg,20843
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.1.0.dist-info/METADATA,sha256=a1k_yMC8QdtjTmj0cYhmCG_yAilCrG5WKlnm91Ljukg,2213
29
- dayhoff_tools-1.1.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
30
- dayhoff_tools-1.1.0.dist-info/entry_points.txt,sha256=iAf4jteNqW3cJm6CO6czLxjW3vxYKsyGLZ8WGmxamSc,49
31
- dayhoff_tools-1.1.0.dist-info/RECORD,,
28
+ dayhoff_tools-1.1.2.dist-info/METADATA,sha256=5tt1iO_M0YddPk-2Ne3b3f6rzYJIkuije8Ad6M4E3aI,2213
29
+ dayhoff_tools-1.1.2.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
30
+ dayhoff_tools-1.1.2.dist-info/entry_points.txt,sha256=iAf4jteNqW3cJm6CO6czLxjW3vxYKsyGLZ8WGmxamSc,49
31
+ dayhoff_tools-1.1.2.dist-info/RECORD,,