Skip to main content

The interface for Snakemake report plugins.

Project description

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.
        ...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

snakemake_interface_report_plugins-1.1.2.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file snakemake_interface_report_plugins-1.1.2.tar.gz.

File metadata

File hashes

Hashes for snakemake_interface_report_plugins-1.1.2.tar.gz
Algorithm Hash digest
SHA256 3d1218c5897345632f138a3f02794dfef7e59e407100c2a87313307a2da63c5b
MD5 3e5092869091f41054c5b5f69c9700f3
BLAKE2b-256 ca282a4ccc26e51ad50df487d0a856e547edf0044dd987998c93e718bac6df65

See more details on using hashes here.

File details

Details for the file snakemake_interface_report_plugins-1.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for snakemake_interface_report_plugins-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b332d7438fd328c4b59bfac773c7e85e4cc5703c043d10286ec3b1da6b72d9d8
MD5 68d2e0b541624181dc59a9f56921cef8
BLAKE2b-256 6142ba61c5339484d89aab54e27fa664bc8b10732000a693d26237b9b23d2e62

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page