# 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 Snakemake's poetry plugin to set up this skeleton (and automated testing) within a python package, see https://github.com/snakemake/poetry-snakemake-plugin.
```python
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.
...
```
Raw data
{
"_id": null,
"home_page": null,
"name": "snakemake-interface-report-plugins",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.11",
"maintainer_email": null,
"keywords": null,
"author": "Johannes Koester",
"author_email": "johannes.koester@uni-due.de",
"download_url": "https://files.pythonhosted.org/packages/5e/ae/ee9a6c9475e380bb55020dc161ab08698fe85da9e866477bfb333b15a0ed/snakemake_interface_report_plugins-1.1.0.tar.gz",
"platform": null,
"description": "# Snakemake interface for report plugins\n\nThis package defines the interface between Snakemake and its report plugins.\n\nPlugins should implement the following skeleton to comply with this interface.\nIt is recommended to use Snakemake's poetry plugin to set up this skeleton (and automated testing) within a python package, see https://github.com/snakemake/poetry-snakemake-plugin.\n\n```python\n\nfrom dataclasses import dataclass, field\n\nfrom snakemake_interface_common.exceptions import WorkflowError\nfrom snakemake_interface_report_plugins.reporter import ReporterBase\nfrom snakemake_interface_report_plugins.settings import ReportSettingsBase\n\n\n# Optional:\n# Define additional settings for your reporter.\n# They will occur in the Snakemake CLI as --report-<reporter-name>-<param-name>\n# Omit this class if you don't need any.\n# Make sure that all defined fields are Optional (or bool) and specify a default value\n# of None (or False) or anything else that makes sense in your case.\n@dataclass\nclass ReportSettings(ReportSettingsBase):\n myparam: Optional[int] = field(\n default=None,\n metadata={\n \"help\": \"Some help text\",\n # Optionally request that setting is also available for specification\n # via an environment variable. The variable will be named automatically as\n # SNAKEMAKE_REPORT_<reporter-name>_<param-name>, all upper case.\n # This mechanism should ONLY be used for passwords and usernames.\n # For other items, we rather recommend to let people use a profile\n # for setting defaults\n # (https://snakemake.readthedocs.io/en/stable/executing/cli.html#profiles).\n \"env_var\": False,\n # Optionally specify a function that parses the value given by the user.\n # This is useful to create complex types from the user input.\n \"parse_func\": ...,\n # If a parse_func is specified, you also have to specify an unparse_func\n # that converts the parsed value back to a string.\n \"unparse_func\": ...,\n # Optionally specify that setting is required when the reporter is in use.\n \"required\": True,\n # Optionally specify multiple args with \"nargs\": True\n },\n )\n\n\n# Required:\n# Implementation of your reporter\nclass Reporter(ReporterBase):\n def __post_init__(self):\n # initialize additional attributes\n # Do not overwrite the __init__ method as this is kept in control of the base\n # class in order to simplify the update process.\n # See https://github.com/snakemake/snakemake-interface-report-plugins/snakemake_interface_report_plugins/reporter.py\n # for attributes of the base class.\n # In particular, the settings of above ReportSettings class are accessible via\n # self.settings.\n\n def render(self):\n # Render the report, using attributes of the base class.\n ...\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "The interface for Snakemake report plugins.",
"version": "1.1.0",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3589f5f4e48b72fca04458a2fe4f4b02e10f95fb47772b0d0ea889ac929c3b1e",
"md5": "d576b0b0fb16837bb2fb0a499269a0a4",
"sha256": "00749eb3c5c7ce465757d0fc9f04e6c4d3f5af4f463809c34b92c8b5efea0fd5"
},
"downloads": -1,
"filename": "snakemake_interface_report_plugins-1.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d576b0b0fb16837bb2fb0a499269a0a4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.11",
"size": 7076,
"upload_time": "2024-10-04T14:56:35",
"upload_time_iso_8601": "2024-10-04T14:56:35.658953Z",
"url": "https://files.pythonhosted.org/packages/35/89/f5f4e48b72fca04458a2fe4f4b02e10f95fb47772b0d0ea889ac929c3b1e/snakemake_interface_report_plugins-1.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5eaeee9a6c9475e380bb55020dc161ab08698fe85da9e866477bfb333b15a0ed",
"md5": "2dabad74b9994ac736eaba4a04d7c848",
"sha256": "b1ee444b2fca51225cf8a102f8e56633791d01433cd00cf07a1d9713a12313a5"
},
"downloads": -1,
"filename": "snakemake_interface_report_plugins-1.1.0.tar.gz",
"has_sig": false,
"md5_digest": "2dabad74b9994ac736eaba4a04d7c848",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.11",
"size": 4383,
"upload_time": "2024-10-04T14:56:36",
"upload_time_iso_8601": "2024-10-04T14:56:36.732922Z",
"url": "https://files.pythonhosted.org/packages/5e/ae/ee9a6c9475e380bb55020dc161ab08698fe85da9e866477bfb333b15a0ed/snakemake_interface_report_plugins-1.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-04 14:56:36",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "snakemake-interface-report-plugins"
}