dayhoff-tools 1.1.17__tar.gz → 1.1.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 (31) hide show
  1. {dayhoff_tools-1.1.17 → dayhoff_tools-1.1.19}/PKG-INFO +1 -1
  2. {dayhoff_tools-1.1.17 → dayhoff_tools-1.1.19}/dayhoff_tools/cli/cloud_commands.py +66 -0
  3. {dayhoff_tools-1.1.17 → dayhoff_tools-1.1.19}/dayhoff_tools/deployment/processors.py +10 -6
  4. {dayhoff_tools-1.1.17 → dayhoff_tools-1.1.19}/pyproject.toml +1 -1
  5. {dayhoff_tools-1.1.17 → dayhoff_tools-1.1.19}/README.md +0 -0
  6. {dayhoff_tools-1.1.17 → dayhoff_tools-1.1.19}/dayhoff_tools/__init__.py +0 -0
  7. {dayhoff_tools-1.1.17 → dayhoff_tools-1.1.19}/dayhoff_tools/chemistry/standardizer.py +0 -0
  8. {dayhoff_tools-1.1.17 → dayhoff_tools-1.1.19}/dayhoff_tools/chemistry/utils.py +0 -0
  9. {dayhoff_tools-1.1.17 → dayhoff_tools-1.1.19}/dayhoff_tools/cli/__init__.py +0 -0
  10. {dayhoff_tools-1.1.17 → dayhoff_tools-1.1.19}/dayhoff_tools/cli/main.py +0 -0
  11. {dayhoff_tools-1.1.17 → dayhoff_tools-1.1.19}/dayhoff_tools/cli/swarm_commands.py +0 -0
  12. {dayhoff_tools-1.1.17 → dayhoff_tools-1.1.19}/dayhoff_tools/cli/utility_commands.py +0 -0
  13. {dayhoff_tools-1.1.17 → dayhoff_tools-1.1.19}/dayhoff_tools/deployment/base.py +0 -0
  14. {dayhoff_tools-1.1.17 → dayhoff_tools-1.1.19}/dayhoff_tools/deployment/deploy_aws.py +0 -0
  15. {dayhoff_tools-1.1.17 → dayhoff_tools-1.1.19}/dayhoff_tools/deployment/deploy_gcp.py +0 -0
  16. {dayhoff_tools-1.1.17 → dayhoff_tools-1.1.19}/dayhoff_tools/deployment/deploy_utils.py +0 -0
  17. {dayhoff_tools-1.1.17 → dayhoff_tools-1.1.19}/dayhoff_tools/deployment/job_runner.py +0 -0
  18. {dayhoff_tools-1.1.17 → dayhoff_tools-1.1.19}/dayhoff_tools/deployment/swarm.py +0 -0
  19. {dayhoff_tools-1.1.17 → dayhoff_tools-1.1.19}/dayhoff_tools/embedders.py +0 -0
  20. {dayhoff_tools-1.1.17 → dayhoff_tools-1.1.19}/dayhoff_tools/fasta.py +0 -0
  21. {dayhoff_tools-1.1.17 → dayhoff_tools-1.1.19}/dayhoff_tools/file_ops.py +0 -0
  22. {dayhoff_tools-1.1.17 → dayhoff_tools-1.1.19}/dayhoff_tools/h5.py +0 -0
  23. {dayhoff_tools-1.1.17 → dayhoff_tools-1.1.19}/dayhoff_tools/intake/gcp.py +0 -0
  24. {dayhoff_tools-1.1.17 → dayhoff_tools-1.1.19}/dayhoff_tools/intake/gtdb.py +0 -0
  25. {dayhoff_tools-1.1.17 → dayhoff_tools-1.1.19}/dayhoff_tools/intake/kegg.py +0 -0
  26. {dayhoff_tools-1.1.17 → dayhoff_tools-1.1.19}/dayhoff_tools/intake/mmseqs.py +0 -0
  27. {dayhoff_tools-1.1.17 → dayhoff_tools-1.1.19}/dayhoff_tools/intake/structure.py +0 -0
  28. {dayhoff_tools-1.1.17 → dayhoff_tools-1.1.19}/dayhoff_tools/intake/uniprot.py +0 -0
  29. {dayhoff_tools-1.1.17 → dayhoff_tools-1.1.19}/dayhoff_tools/logs.py +0 -0
  30. {dayhoff_tools-1.1.17 → dayhoff_tools-1.1.19}/dayhoff_tools/sqlite.py +0 -0
  31. {dayhoff_tools-1.1.17 → dayhoff_tools-1.1.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.1.17
3
+ Version: 1.1.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
@@ -902,6 +902,72 @@ def gcp_use_devcon_adc():
902
902
  sys.exit(1)
903
903
 
904
904
 
905
+ @gcp_app.command("logout")
906
+ def gcp_logout():
907
+ """Clear all GCP credentials for testing or role switching purposes.
908
+
909
+ This removes the active user's gcloud login, disables impersonation,
910
+ and invalidates Application Default Credentials (ADC).
911
+ """
912
+ print(f"{BLUE}Clearing all GCP credentials...{NC}")
913
+
914
+ try:
915
+ gcloud_path = _find_executable("gcloud")
916
+ errors = []
917
+
918
+ # 1. Revoke user-level credentials
919
+ print(f"{BLUE}Revoking active gcloud credentials...{NC}")
920
+ revoke_cmd = [gcloud_path, "auth", "revoke", "--all", "--quiet"]
921
+ revoke_code, _, revoke_err = _run_command(revoke_cmd, capture=True, check=False)
922
+ if revoke_code != 0 and revoke_err:
923
+ errors.append(f"Failed to revoke credentials: {revoke_err}")
924
+
925
+ # 2. Unset impersonation config
926
+ print(f"{BLUE}Disabling service account impersonation...{NC}")
927
+ unset_code, _, unset_err = _gcloud_unset_config(
928
+ "auth/impersonate_service_account"
929
+ )
930
+ if unset_code != 0 and unset_err:
931
+ errors.append(f"Failed to unset impersonation: {unset_err}")
932
+
933
+ # 3. Revoke ADC
934
+ print(f"{BLUE}Revoking Application Default Credentials (ADC)...{NC}")
935
+ adc_cmd = [gcloud_path, "auth", "application-default", "revoke", "--quiet"]
936
+ adc_code, _, adc_err = _run_command(adc_cmd, capture=True, check=False)
937
+
938
+ # 4. Additionally remove ADC file if it exists (belt-and-suspenders approach)
939
+ adc_file = (
940
+ Path.home() / ".config" / "gcloud" / "application_default_credentials.json"
941
+ )
942
+ if adc_file.exists():
943
+ try:
944
+ adc_file.unlink()
945
+ print(f"{BLUE}Removed ADC file: {adc_file}{NC}")
946
+ except Exception as e:
947
+ errors.append(f"Failed to delete ADC file: {e}")
948
+
949
+ if errors:
950
+ print(f"{YELLOW}Logged out with some warnings:{NC}")
951
+ for err in errors:
952
+ print(f"{YELLOW} - {err}{NC}")
953
+ else:
954
+ print(f"{GREEN}Successfully logged out from GCP.{NC}")
955
+
956
+ # Always show how to log back in
957
+ print(f"\n{BLUE}To log back in:{NC}")
958
+ print(f" {YELLOW}dh gcp login{NC}")
959
+
960
+ # Show current (now-cleared) status
961
+ print(f"\n{BLUE}Current status:{NC}")
962
+ gcp_status()
963
+
964
+ except Exception as e:
965
+ print(f"{RED}Error during logout: {e}{NC}", file=sys.stderr)
966
+ print(f"{YELLOW}You may need to manually run:{NC}")
967
+ print(f" {YELLOW}gcloud auth revoke --all{NC}")
968
+ print(f" {YELLOW}gcloud auth application-default revoke{NC}")
969
+
970
+
905
971
  # === End NEW ADC Commands ===
906
972
 
907
973
 
@@ -405,16 +405,20 @@ class MMSeqsProfileProcessor(Processor):
405
405
  run_base_dir,
406
406
  )
407
407
 
408
- # 9. Extract hit sequences directly to FASTA using result2flat
408
+ # 9. Extract hit sequences directly to FASTA using createseqfiledb
409
409
  self._run_mmseqs_command(
410
410
  [
411
411
  "mmseqs",
412
412
  "createseqfiledb",
413
- str(result_db), # resultDB containing target hits
414
- str(target_db), # targetDB containing actual sequences
415
- str(intermediate_hits_fasta_file), # output FASTA
416
- "--db-output",
417
- "1", # Output in FASTA format
413
+ str(target_db), # <i:sequenceDB> - The DB to pull sequences from
414
+ str(
415
+ result_db
416
+ ), # <i:resultDB> - Contains IDs of target sequences to pull
417
+ str(
418
+ intermediate_hits_fasta_file
419
+ ), # <o:fastaDB> - Output FASTA file
420
+ "--threads", # createseqfiledb supports --threads
421
+ self.num_threads,
418
422
  ],
419
423
  "Extract hit sequences to FASTA via createseqfiledb",
420
424
  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.17"
8
+ version = "1.1.19"
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