Registry / workflow / snakemake-interface-report-plugins

snakemake-interface-report-plugins

JSON →
library2.0.1pypypiunverified

This library provides the abstract base classes, decorators, and type hints required to develop custom report plugins for Snakemake workflows. It defines the standardized interface that Snakemake uses to discover and interact with report plugins. As an interface package, it aims for API stability for plugin developers and generally follows Snakemake's major release cadence. The current version is 2.0.1 and requires Python 3.11 or newer.

pip install snakemake-interface-report-plugins
INSTALL
IMPORT
SIG · SNAKEMAKE-INTERFAC
S
snakemake-interface-report-plugins
workflowpythonv2.0.1
Install
1.8s avg
Import
—
Disk
15MB
Pass rate
6/ 10
Env Coverage6 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v2.0.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✕ build_error
✕ build_error
py 3.11
✓ —
✓ 1.93s
py 3.12
✓ —
✓ 1.7s
py 3.13
✓ —
✓ 1.7s
py 3.9
✕ build_error
✕ build_error
15MB installed
● package 15MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ReportPluginBase
✓ from snakemake_interface_report_plugins.report_plugin_base import ReportPluginBase
✗ from snakemake_interface_report_plugins import ReportPluginBase

This quickstart demonstrates how to define a basic Snakemake report plugin. Plugins must inherit from `ReportPluginBase` and be decorated with `@register_report_plugin`. They implement methods like `get_report_name` and `get_report_html` to provide content to the Snakemake report. This file would typically be placed in a directory discoverable by Snakemake as a plugin source.

import os from pathlib import Path from snakemake_interface_report_plugins.api import ReportPluginBase, register_report_plugin @register_report_plugin class MyCustomReportPlugin(ReportPluginBase): """ A minimal Snakemake report plugin demonstrating the required interface. """ def __init__( self, report_dir: Path, report_paths: dict[str, Path], log_file: Path, **kwargs, ): super().__init__(report_dir, report_paths, log_file, **kwargs) self.plugin_id = kwargs.get("name", "my-custom-report") # Custom initialization logic here def get_report_name(self) -> str: """Returns the unique name for this report plugin.""" return self.plugin_id def get_report_css(self) -> list[Path]: """Returns a list of paths to CSS files for the report.""" # In a real plugin, these would typically be relative paths to files # within the plugin's package, resolved by pkg_resources or importlib.resources. return [] def get_report_js(self) -> list[Path]: """Returns a list of paths to JS files for the report.""" return [] def get_report_html(self, jobid: str) -> str: """ Generates the HTML content for a specific job ID. This content will be embedded into the final Snakemake report. """ return f""" <div class="custom-report-section"> <h3>Report for job: <code>{jobid}</code> from {self.plugin_id}</h3> <p>Report directory: {self.report_dir}</p> <p>Log file: {self.log_file}</p> <p>Timestamp: {os.path.getmtime(self.log_file) if self.log_file.exists() else 'N/A'}</p> </div> """ # To demonstrate, a plugin needs to be discovered by Snakemake. # This example code does not run a Snakemake workflow, but shows # the structure of a plugin Python file. # In a real scenario, Snakemake would import and instantiate this class. if __name__ == "__main__": # Simulate Snakemake's environment for instantiation temp_dir = Path("./temp_plugin_test").resolve() temp_dir.mkdir(exist_ok=True) sample_log_file = temp_dir / "sample_log.txt" sample_log_file.write_text("Log content here.") # Snakemake would instantiate your plugin like this: mock_report_paths = {"summary": temp_dir / "summary.html"} plugin_instance = MyCustomReportPlugin( report_dir=temp_dir, report_paths=mock_report_paths, log_file=sample_log_file, name="demo-plugin-instance" ) print(f"Plugin registered: {plugin_instance.get_report_name()}") print(f"Example HTML output for 'job_A':\n{plugin_instance.get_report_html('job_A')}") # Cleanup sample_log_file.unlink() temp_dir.rmdir()
Debug
Known issues
breakingVersion 2.0.0 introduced significant breaking changes for plugin developers. The plugin registration mechanism was refactored, requiring plugins to explicitly inherit from `ReportPluginBase` and use the `@register_report_plugin` decorator. Older plugins designed for `snakemake-interface-report-plugins` v1.x will not be compatible.
fix
Update your plugin code to inherit `ReportPluginBase` and decorate the class with `@register_report_plugin` as shown in the quickstart. Review the official Snakemake plugin documentation for full details.
affects: >=2.0.0
gotchaThis library defines the *interface* for plugins, not the core logic for running Snakemake reports. While you implement the plugin using this interface, the plugin itself must be discovered and invoked by a compatible Snakemake core version (typically Snakemake >=8.0.0 for v2 plugins).
fix
Ensure your Snakemake installation is compatible with the plugin interface version. This library's API ensures your plugin is correctly structured, but Snakemake itself handles the execution.
affects: All versions
gotchaReport plugins must implement all abstract methods defined in `ReportPluginBase`, such as `get_report_name`, `get_report_css`, `get_report_js`, and `get_report_html`. Failure to do so will result in `TypeError` when the plugin class is instantiated.
fix
Ensure all abstract methods of `ReportPluginBase` are implemented in your custom plugin class. Refer to the quickstart for a complete minimal example.
affects: All versions
gotchaThis library specifically requires Python 3.11 or newer (and less than 4.0). Using an older Python version will lead to installation failures or runtime errors.
fix
Upgrade your Python environment to version 3.11, 3.12, or newer (but less than 4.0).
affects: >=2.0.0
Upgrade
Version history
2.0.1latest on PyPI · released Mar 9, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
34 hits · last 30 days
node
26
OpenAI (training)
3
Resources
snakemake-interface-report-plugins — pip install snakemake-interface-report-plugins · libregistry