Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class Executor(RemoteExecutor):
# access workflow
self.workflow
# access executor specific settings
self.workflow.executor_settings
self.executor_settings

# IMPORTANT: in your plugin, only access methods and properties of
# Snakemake objects (like Workflow, Persistence, etc.) that are
Expand Down
3 changes: 3 additions & 0 deletions snakemake_interface_executor_plugins/executors/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

from snakemake_interface_executor_plugins.jobs import JobExecutorInterface
from snakemake_interface_executor_plugins.logging import LoggerExecutorInterface
from snakemake_interface_executor_plugins.settings import ExecutorSettingsBase
from snakemake_interface_executor_plugins.utils import format_cli_arg
from snakemake_interface_executor_plugins.workflow import WorkflowExecutorInterface

Expand All @@ -25,9 +26,11 @@ def __init__(
self,
workflow: WorkflowExecutorInterface,
logger: LoggerExecutorInterface,
executor_settings: Optional[ExecutorSettingsBase],
):
self.workflow = workflow
self.dag = workflow.dag
self.executor_settings = executor_settings
self.logger = logger

def get_resource_declarations_dict(self, job: JobExecutorInterface):
Expand Down
8 changes: 5 additions & 3 deletions snakemake_interface_executor_plugins/executors/real.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
__license__ = "MIT"

from abc import abstractmethod
from typing import Dict
from typing import Dict, Optional

from snakemake_interface_common import at_least_snakemake_version
from snakemake_interface_executor_plugins.executors.base import (
AbstractExecutor,
SubmittedJobInfo,
)
from snakemake_interface_executor_plugins.logging import LoggerExecutorInterface
from snakemake_interface_executor_plugins.settings import ExecMode
from snakemake_interface_executor_plugins.settings import ExecMode, ExecutorSettingsBase
from snakemake_interface_executor_plugins.utils import (
encode_target_jobs_cli_args,
format_cli_arg,
Expand All @@ -27,13 +27,15 @@ def __init__(
self,
workflow: WorkflowExecutorInterface,
logger: LoggerExecutorInterface,
executor_settings: Optional[ExecutorSettingsBase],
post_init: bool = True,
):
super().__init__(
workflow,
logger,
executor_settings,
)
self.executor_settings = self.workflow.executor_settings
self.executor_settings = executor_settings
self.snakefile = workflow.main_snakefile
if post_init:
self.__post_init__()
Expand Down
8 changes: 1 addition & 7 deletions snakemake_interface_executor_plugins/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,16 +176,10 @@ def assume_common_workdir(self) -> bool:
)


class DeploymentMethod(SettingsEnumBase):
CONDA = 0
APPTAINER = 1
ENV_MODULES = 2


class DeploymentSettingsExecutorInterface(ABC):
@property
@abstractmethod
def deployment_method(self) -> Set[DeploymentMethod]: ...
def deployment_method(self) -> Set[str]: ...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

🧩 Analysis chain

Verify all implementations and usages have been updated.

The change from Set[DeploymentMethod] to Set[str] is a breaking change that removes compile-time type safety. While this increases flexibility for extensibility, ensure that:

  1. All implementations of DeploymentSettingsExecutorInterface have been updated to return Set[str]
  2. All code that calls deployment_method has been updated to handle strings instead of enum values
  3. Valid deployment method string values are documented or validated somewhere

Run the following script to verify implementations and usages:


🏁 Script executed:

#!/bin/bash
# Description: Find all implementations of deployment_method and usages to verify they've been updated

echo "=== Searching for implementations of deployment_method ==="
ast-grep --pattern 'def deployment_method($$$) -> $RET:
  $$$'

echo -e "\n=== Searching for calls to deployment_method ==="
rg -nP --type=py -C3 '\.deployment_method\b'

echo -e "\n=== Checking for any remaining references to DeploymentMethod enum ==="
rg -nP --type=py '\bDeploymentMethod\b'

Length of output: 282


Document deployment_method return type change and add migration guide.

  • Return type changed from Set[DeploymentMethod] to Set[str]; there are no remaining internal references to DeploymentMethod.
  • This is a breaking change for external plugins and consumers—update documentation to reflect the new string‐based identifiers and provide migration instructions.
  • Consider listing or validating allowed deployment method strings to prevent typos at runtime.
🤖 Prompt for AI Agents
In snakemake_interface_executor_plugins/settings.py around line 182, the return
type for deployment_method was changed from Set[DeploymentMethod] to Set[str];
update the public documentation and changelog to note this breaking change, add
a short migration guide showing how to map previous DeploymentMethod enum values
to the new string identifiers, update any API reference and docstrings in this
module to show Set[str], and add a recommended list of allowed deployment method
strings (and optional runtime validation utility or helper function) so plugin
authors can validate inputs and avoid typos.



class GroupSettingsExecutorInterface(ABC):
Expand Down
5 changes: 5 additions & 0 deletions snakemake_interface_executor_plugins/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from snakemake_interface_executor_plugins.cli import (
SpawnedJobArgsFactoryExecutorInterface,
)
from snakemake_interface_executor_plugins.dag import DAGExecutorInterface
from snakemake_interface_executor_plugins.persistence import (
PersistenceExecutorInterface,
)
Expand All @@ -25,6 +26,10 @@


class WorkflowExecutorInterface(ABC):
@property
@abstractmethod
def dag(self) -> DAGExecutorInterface: ...

@property
@abstractmethod
def spawned_job_args_factory(self) -> SpawnedJobArgsFactoryExecutorInterface: ...
Expand Down