dayhoff-tools 1.1.13__tar.gz → 1.1.15__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 (31) hide show
  1. {dayhoff_tools-1.1.13 → dayhoff_tools-1.1.15}/PKG-INFO +1 -1
  2. {dayhoff_tools-1.1.13 → dayhoff_tools-1.1.15}/dayhoff_tools/cli/utility_commands.py +64 -4
  3. {dayhoff_tools-1.1.13 → dayhoff_tools-1.1.15}/dayhoff_tools/deployment/processors.py +0 -3
  4. {dayhoff_tools-1.1.13 → dayhoff_tools-1.1.15}/pyproject.toml +1 -1
  5. {dayhoff_tools-1.1.13 → dayhoff_tools-1.1.15}/README.md +0 -0
  6. {dayhoff_tools-1.1.13 → dayhoff_tools-1.1.15}/dayhoff_tools/__init__.py +0 -0
  7. {dayhoff_tools-1.1.13 → dayhoff_tools-1.1.15}/dayhoff_tools/chemistry/standardizer.py +0 -0
  8. {dayhoff_tools-1.1.13 → dayhoff_tools-1.1.15}/dayhoff_tools/chemistry/utils.py +0 -0
  9. {dayhoff_tools-1.1.13 → dayhoff_tools-1.1.15}/dayhoff_tools/cli/__init__.py +0 -0
  10. {dayhoff_tools-1.1.13 → dayhoff_tools-1.1.15}/dayhoff_tools/cli/cloud_commands.py +0 -0
  11. {dayhoff_tools-1.1.13 → dayhoff_tools-1.1.15}/dayhoff_tools/cli/main.py +0 -0
  12. {dayhoff_tools-1.1.13 → dayhoff_tools-1.1.15}/dayhoff_tools/cli/swarm_commands.py +0 -0
  13. {dayhoff_tools-1.1.13 → dayhoff_tools-1.1.15}/dayhoff_tools/deployment/base.py +0 -0
  14. {dayhoff_tools-1.1.13 → dayhoff_tools-1.1.15}/dayhoff_tools/deployment/deploy_aws.py +0 -0
  15. {dayhoff_tools-1.1.13 → dayhoff_tools-1.1.15}/dayhoff_tools/deployment/deploy_gcp.py +0 -0
  16. {dayhoff_tools-1.1.13 → dayhoff_tools-1.1.15}/dayhoff_tools/deployment/deploy_utils.py +0 -0
  17. {dayhoff_tools-1.1.13 → dayhoff_tools-1.1.15}/dayhoff_tools/deployment/job_runner.py +0 -0
  18. {dayhoff_tools-1.1.13 → dayhoff_tools-1.1.15}/dayhoff_tools/deployment/swarm.py +0 -0
  19. {dayhoff_tools-1.1.13 → dayhoff_tools-1.1.15}/dayhoff_tools/embedders.py +0 -0
  20. {dayhoff_tools-1.1.13 → dayhoff_tools-1.1.15}/dayhoff_tools/fasta.py +0 -0
  21. {dayhoff_tools-1.1.13 → dayhoff_tools-1.1.15}/dayhoff_tools/file_ops.py +0 -0
  22. {dayhoff_tools-1.1.13 → dayhoff_tools-1.1.15}/dayhoff_tools/h5.py +0 -0
  23. {dayhoff_tools-1.1.13 → dayhoff_tools-1.1.15}/dayhoff_tools/intake/gcp.py +0 -0
  24. {dayhoff_tools-1.1.13 → dayhoff_tools-1.1.15}/dayhoff_tools/intake/gtdb.py +0 -0
  25. {dayhoff_tools-1.1.13 → dayhoff_tools-1.1.15}/dayhoff_tools/intake/kegg.py +0 -0
  26. {dayhoff_tools-1.1.13 → dayhoff_tools-1.1.15}/dayhoff_tools/intake/mmseqs.py +0 -0
  27. {dayhoff_tools-1.1.13 → dayhoff_tools-1.1.15}/dayhoff_tools/intake/structure.py +0 -0
  28. {dayhoff_tools-1.1.13 → dayhoff_tools-1.1.15}/dayhoff_tools/intake/uniprot.py +0 -0
  29. {dayhoff_tools-1.1.13 → dayhoff_tools-1.1.15}/dayhoff_tools/logs.py +0 -0
  30. {dayhoff_tools-1.1.13 → dayhoff_tools-1.1.15}/dayhoff_tools/sqlite.py +0 -0
  31. {dayhoff_tools-1.1.13 → dayhoff_tools-1.1.15}/dayhoff_tools/warehouse.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: dayhoff-tools
3
- Version: 1.1.13
3
+ Version: 1.1.15
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
@@ -11,6 +11,46 @@ import toml
11
11
  import typer
12
12
  import yaml
13
13
 
14
+ # Import cloud helper lazily inside functions to avoid heavy deps at module load
15
+
16
+
17
+ def _warn_if_gcp_default_sa(force_prompt: bool = False) -> None:
18
+ """Warn the user when the active gcloud principal is the default VM service
19
+ account. See detailed docstring later in file (duplicate for early
20
+ availability)."""
21
+
22
+ from dayhoff_tools.cli import cloud_commands as _cc
23
+
24
+ try:
25
+ impersonation = _cc._get_current_gcp_impersonation()
26
+ user = _cc._get_current_gcp_user()
27
+ active = impersonation if impersonation != "None" else user
28
+ short = _cc._get_short_name(active)
29
+ except Exception:
30
+ return
31
+
32
+ if short != "default VM service account":
33
+ return
34
+
35
+ YELLOW = getattr(_cc, "YELLOW", "\033[0;33m")
36
+ BLUE = getattr(_cc, "BLUE", "\033[0;36m")
37
+ RED = getattr(_cc, "RED", "\033[0;31m")
38
+ NC = getattr(_cc, "NC", "\033[0m")
39
+
40
+ print(
41
+ f"{YELLOW}⚠ You are currently authenticated as the *default VM service account*.{NC}\n"
42
+ f"{YELLOW} This will block gsutil/DVC access to private buckets (e.g. warehouse).{NC}\n"
43
+ f"{YELLOW} Run {BLUE}dh gcp login{YELLOW} or {BLUE}dh gcp use-devcon{YELLOW} before retrying.{NC}",
44
+ file=sys.stderr,
45
+ )
46
+
47
+ if force_prompt and sys.stdin.isatty() and sys.stdout.isatty():
48
+ import questionary
49
+
50
+ if not questionary.confirm("Proceed anyway?", default=False).ask():
51
+ print(f"{RED}Aborted due to unsafe GCP credentials.{NC}", file=sys.stderr)
52
+ raise SystemExit(1)
53
+
14
54
 
15
55
  def test_github_actions_locally():
16
56
  """Run the script test_pytest_in_github_actions_container.sh.sh."""
@@ -52,9 +92,16 @@ def get_ancestry(filepath: str) -> None:
52
92
 
53
93
  def import_from_warehouse_typer() -> None:
54
94
  """Import a file from warehouse.
55
- This is a thin wrapper around `cli.utils.import_from_warehouse`,
56
- with interactive prompts using questionary.
95
+
96
+ Emits an early warning if the active GCP credentials are the *default VM
97
+ service account* because this will prevent DVC/gsutil from accessing the
98
+ warehouse bucket. The user can abort the command when running
99
+ interactively.
57
100
  """
101
+
102
+ # Early-exit guard for wrong GCP credentials
103
+ _warn_if_gcp_default_sa(force_prompt=True)
104
+
58
105
  # Import only when the function is called
59
106
  import questionary
60
107
  from dayhoff_tools.warehouse import import_from_warehouse
@@ -91,8 +138,16 @@ def import_from_warehouse_typer() -> None:
91
138
 
92
139
 
93
140
  def add_to_warehouse_typer() -> None:
94
- """Add a new data file to warehouse, and expand its .dvc file with
95
- metadata, including ancestor files."""
141
+ """Add a new data file to warehouse and enrich its generated .dvc file.
142
+
143
+ As with *dh wimport*, this command fails when the user is logged in with
144
+ the default VM service account. A guard therefore warns the user first
145
+ and allows them to abort interactively.
146
+ """
147
+
148
+ # Early-exit guard for wrong GCP credentials
149
+ _warn_if_gcp_default_sa(force_prompt=True)
150
+
96
151
  # Import only when the function is called
97
152
  import questionary
98
153
  from dayhoff_tools.warehouse import add_to_warehouse
@@ -548,3 +603,8 @@ def update_dependencies(
548
603
  except Exception as e:
549
604
  print(f"An unexpected error occurred: {e}")
550
605
  sys.exit(1)
606
+
607
+
608
+ # ----------------------
609
+ # Cloud credential guard
610
+ # ----------------------
@@ -283,7 +283,6 @@ class MMSeqsProfileProcessor(Processor):
283
283
  aln_db = mmseqs_temp_dir / "alnDB"
284
284
  profile_db = mmseqs_temp_dir / "profileDB"
285
285
  result_db = mmseqs_temp_dir / "resultDB"
286
- hits_db = mmseqs_temp_dir / "hitsDB"
287
286
 
288
287
  try:
289
288
  # 1. Create query database
@@ -417,8 +416,6 @@ class MMSeqsProfileProcessor(Processor):
417
416
  str(intermediate_hits_fasta_file), # output FASTA
418
417
  "--use-fasta-header",
419
418
  "1",
420
- "--threads",
421
- self.num_threads,
422
419
  ],
423
420
  "Extract hit sequences to FASTA via result2flat",
424
421
  run_base_dir,
@@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api"
5
5
 
6
6
  [project]
7
7
  name = "dayhoff-tools"
8
- version = "1.1.13"
8
+ version = "1.1.15"
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"}
File without changes