Snakemake Executor Plugins Interface

9.4.0 · active · verified Thu Apr 16

This package provides a stable, versioned interface for interactions between Snakemake and its executor plugins. It defines the abstract base classes and data structures that plugin developers must implement to integrate custom execution backends with Snakemake. The current version is 9.4.0, and its release cadence is closely tied to major Snakemake releases, ensuring compatibility and stability for plugin development.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to define custom executor settings by subclassing `ExecutorSettingsBase`. This is a common first step for developing a Snakemake executor plugin, allowing the plugin to expose configurable parameters.

from snakemake_interface_executor_plugins.settings import ExecutorSettingsBase
from typing import Optional

# Define custom settings for a hypothetical executor plugin
class MyCustomExecutorSettings(ExecutorSettingsBase):
    """
    Settings for MyCustomExecutor.
    """
    my_custom_param: str = "default_value"
    another_setting: Optional[int] = None

    def __post_init__(self):
        # Optional: Add validation or post-initialization logic
        if not self.my_custom_param:
            raise ValueError("my_custom_param cannot be empty")
        print(f"MyCustomExecutorSettings initialized: {self.my_custom_param}")

# Example of creating an instance of the custom settings
if __name__ == "__main__":
    try:
        settings = MyCustomExecutorSettings(my_custom_param="special_value")
        print(f"Custom param: {settings.my_custom_param}")
        
        invalid_settings = MyCustomExecutorSettings(my_custom_param="")
    except ValueError as e:
        print(f"Caught expected error for empty param: {e}")

view raw JSON →