Skip to main content

Snakemake interface for report plugins

This package defines the interface between Snakemake and its report plugins.

Plugins should implement the following skeleton to comply with this interface. It is recommended to use Snakedeploy to set up the skeleton (and automated testing) within a python package.

from dataclasses import dataclass, field

from snakemake_interface_common.exceptions import WorkflowError
from snakemake_interface_report_plugins.reporter import ReporterBase
from snakemake_interface_report_plugins.settings import ReportSettingsBase


# Optional:
# Define additional settings for your reporter.
# They will occur in the Snakemake CLI as --report-<reporter-name>-<param-name>
# Omit this class if you don't need any.
# Make sure that all defined fields are Optional (or bool) and specify a default value
# of None (or False) or anything else that makes sense in your case.
@dataclass
class ReportSettings(ReportSettingsBase):
    myparam: Optional[int] = field(
        default=None,
        metadata={
            "help": "Some help text",
            # Optionally request that setting is also available for specification
            # via an environment variable. The variable will be named automatically as
            # SNAKEMAKE_REPORT_<reporter-name>_<param-name>, all upper case.
            # This mechanism should ONLY be used for passwords and usernames.
            # For other items, we rather recommend to let people use a profile
            # for setting defaults
            # (https://snakemake.readthedocs.io/en/stable/executing/cli.html#profiles).
            "env_var": False,
            # Optionally specify a function that parses the value given by the user.
            # This is useful to create complex types from the user input.
            "parse_func": ...,
            # If a parse_func is specified, you also have to specify an unparse_func
            # that converts the parsed value back to a string.
            "unparse_func": ...,
            # Optionally specify that setting is required when the reporter is in use.
            "required": True,
            # Optionally specify multiple args with "nargs": True
        },
    )


# Required:
# Implementation of your reporter
class Reporter(ReporterBase):
    def __post_init__(self):
        # initialize additional attributes
        # Do not overwrite the __init__ method as this is kept in control of the base
        # class in order to simplify the update process.
        # See https://github.com/snakemake/snakemake-interface-report-plugins/snakemake_interface_report_plugins/reporter.py
        # for attributes of the base class.
        # In particular, the settings of above ReportSettings class are accessible via
        # self.settings.

    def render(self):
        # Render the report, using attributes of the base class.
        ...

Metadata

Release files for snakemake-interface-report-plugins 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for snakemake-interface-report-plugins 2.0.1
File Size Uploaded
snakemake_interface_report_plugins-2.0.1.tar.gz 4.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for snakemake-interface-report-plugins 2.0.1
File Interpreter ABI Platform
snakemake_interface_report_plugins-2.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 11.5 kB

Release files / snakemake_interface_report_plugins-2.0.1.tar.gz

Download URL snakemake_interface_report_plugins-2.0.1.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
05b2b88d249a30f8de8c81f85d70ce6e1762d098aea145accf571344140bfef8
BLAKE2b-256 checksum
How to use checksums
4d2b44b950dcc1f9f79d0639dae132b83b34f7ce904f5383e40d0ffdd4c209de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.2 CPython/3.11.14 Linux/6.14.0-1017-azure

Release files / snakemake_interface_report_plugins-2.0.1-py3-none-any.whl

Download URL snakemake_interface_report_plugins-2.0.1-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3f0027c506e71916f389cf37948175d0a007ccff72928a275d60f84310d1a65b
BLAKE2b-256 checksum
How to use checksums
cd87681f8f78a7ad969dccb2ce35c9b023a4e40ae86441d222595de14444f0e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.2 CPython/3.11.14 Linux/6.14.0-1017-azure

Release history Release notifications | RSS feed

This release

2.0.1 This release

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page