From 8f8119179acb7a8fc392339b044fc53ee15f33c1 Mon Sep 17 00:00:00 2001 From: Johannes Koester Date: Tue, 2 Jun 2026 21:32:36 +0200 Subject: [PATCH 1/2] feat: suffix replacement --- .../__init__.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/snakemake_interface_software_deployment_plugins/__init__.py b/snakemake_interface_software_deployment_plugins/__init__.py index 0c27039..e744271 100644 --- a/snakemake_interface_software_deployment_plugins/__init__.py +++ b/snakemake_interface_software_deployment_plugins/__init__.py @@ -33,9 +33,16 @@ from snakemake_interface_common.software import SoftwareReport +@dataclass +class SuffixReplacement: + old_suffixes: List[str] + new_suffix: str + + @dataclass class EnvSpecSourceFile: path_or_uri: Union[str, Path] + suffix_replacement: Optional[SuffixReplacement] = None cached: Optional[Path] = field(repr=False, default=None) def __eq__(self, other) -> bool: @@ -46,6 +53,16 @@ def __eq__(self, other) -> bool: def __hash__(self) -> int: return hash(self.path_or_uri) + def replace_suffix(self, suffixes: List[str], new_suffix: str) -> "EnvSpecSourceFile": + if self.suffix_replacement is not None: + raise ValueError("Suffix replacement already defined for this source file.") + return EnvSpecSourceFile( + path_or_uri=self.path_or_uri, + suffix_replacement=SuffixReplacement( + old_suffixes=suffixes, new_suffix=new_suffix + ), + ) + class EnvSpecBase(ABC): @classmethod @@ -306,6 +323,7 @@ def _managed_generic_hash(self, kind: str) -> str: if store is None: record_hash = f"record_{kind}" hash_object = hashlib.md5(usedforsecurity=False) + breakpoint() if self.within is not None and self.hash_include_within(): # For within, we always take the normal hash, # since the deployment just runs within that. From 5d5c27b194b809f389d124b0353e5f8944a8fc65 Mon Sep 17 00:00:00 2001 From: Johannes Koester Date: Tue, 2 Jun 2026 21:33:48 +0200 Subject: [PATCH 2/2] fmt --- snakemake_interface_software_deployment_plugins/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/snakemake_interface_software_deployment_plugins/__init__.py b/snakemake_interface_software_deployment_plugins/__init__.py index e744271..e13565b 100644 --- a/snakemake_interface_software_deployment_plugins/__init__.py +++ b/snakemake_interface_software_deployment_plugins/__init__.py @@ -53,7 +53,9 @@ def __eq__(self, other) -> bool: def __hash__(self) -> int: return hash(self.path_or_uri) - def replace_suffix(self, suffixes: List[str], new_suffix: str) -> "EnvSpecSourceFile": + def replace_suffix( + self, suffixes: List[str], new_suffix: str + ) -> "EnvSpecSourceFile": if self.suffix_replacement is not None: raise ValueError("Suffix replacement already defined for this source file.") return EnvSpecSourceFile(