From 83f3faccb432df7cd1c0031e76b2cdfa9ba4ad50 Mon Sep 17 00:00:00 2001 From: fbartusch Date: Fri, 7 Jun 2024 18:22:12 +0200 Subject: [PATCH] Add snakemake reporter plugin skeleton Created a new reporter from the Snakemake plugin template Added some documentation to README --- README.md | 82 +++++++++++++++ .../.github/workflows/ci.yml | 94 ++++++++++++++++++ .../.github/workflows/conventional-prs.yml | 16 +++ .../.github/workflows/release-please.yml | 53 ++++++++++ snakemake-report-plugin-wrroc/README.md | 0 ...report_plugin_wrroc-0.1.0-py3-none-any.whl | Bin 0 -> 2555 bytes ...snakemake_report_plugin_wrroc-0.1.0.tar.gz | Bin 0 -> 2043 bytes snakemake-report-plugin-wrroc/poetry.lock | 61 ++++++++++++ snakemake-report-plugin-wrroc/pyproject.toml | 17 ++++ snakemake-report-plugin-wrroc/setup.cfg | 7 ++ .../snakemake_report_plugin_wrroc/__init__.py | 63 ++++++++++++ snakemake-report-plugin-wrroc/tests/tests.py | 16 +++ 12 files changed, 409 insertions(+) create mode 100644 snakemake-report-plugin-wrroc/.github/workflows/ci.yml create mode 100644 snakemake-report-plugin-wrroc/.github/workflows/conventional-prs.yml create mode 100644 snakemake-report-plugin-wrroc/.github/workflows/release-please.yml create mode 100644 snakemake-report-plugin-wrroc/README.md create mode 100644 snakemake-report-plugin-wrroc/dist/snakemake_report_plugin_wrroc-0.1.0-py3-none-any.whl create mode 100644 snakemake-report-plugin-wrroc/dist/snakemake_report_plugin_wrroc-0.1.0.tar.gz create mode 100644 snakemake-report-plugin-wrroc/poetry.lock create mode 100644 snakemake-report-plugin-wrroc/pyproject.toml create mode 100644 snakemake-report-plugin-wrroc/setup.cfg create mode 100644 snakemake-report-plugin-wrroc/snakemake_report_plugin_wrroc/__init__.py create mode 100644 snakemake-report-plugin-wrroc/tests/tests.py diff --git a/README.md b/README.md index cdbe509..97d43dd 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,84 @@ # ro-crate_snakemake_tooling Collection of python tools for processing snakemake metadata for RO-Crate creation + + +## Snakemake reporter plugin + +Documentation how the wrroc reporter plugin is built. + +### Setup poetry + +Poetry is used for setting up a new plugin from a template. +In my experience, the Python version used here has to match the Python version used with Snakemake environment, otherwise the plugin does not work. +But this should be a solvable problem. + +``` +conda create --name poetry python=3.12 +conda activate poetry +pip install poetry +``` + +### Create new plugin from the template + +Note: The poetry project was added to this repository. +You only have to install the poetry plugin and can use the project in this repository. + +``` +# Install poetry plugin via +poetry self add poetry-snakemake-plugin + +# Create a new poetry project via +poetry new snakemake-report-plugin-wrroc + +cd snakemake-report-plugin-wrroc + +# Scaffold the project as a snakemake report plugin +poetry scaffold-snakemake-report-plugin + +# Next, edit the scaffolded code according to your needs, and publish +# the resulting plugin into a github repository. The scaffold command also +# creates github actions workflows that will immediately start to check and test +# the plugin. +``` + +### Implement plugin + +Implement the report `render` method here: + +``` +snakemake-report-plugin-wrroc/snakemake_report_plugin_wrroc/__init__.py +``` + +For plugin development one can take a look what information the base class [ReporterBase](https://github.com/snakemake/snakemake-interface-report-plugins/blob/main/snakemake_interface_report_plugins/reporter.py) provides. + +### Build and install plugin + +Build wheel and tar.gz: + +``` +poetry build +``` + +Install the plugin. + +``` +pip install --force-reinstall dist/snakemake_report_plugin_wrroc-0.1.0-py3-none-any.whl +``` + +Snakemake should find the plugin! Note that there are many copy&paste errors for the reporter plugin, even in the poetry template repository. Most of the time the term `executor plugin` is used instead of `reporter plugin`. + +``` +snakemake -h +[...] +wrroc executor settings: + --report-wrroc-myparam VALUE + Some help text (default: ) +``` + +### Create a report + +Test the reporter plugin in the skim2mt directory, where the `.snakemake/metadata` resides: + +``` +snakemake --reporter wrroc +``` \ No newline at end of file diff --git a/snakemake-report-plugin-wrroc/.github/workflows/ci.yml b/snakemake-report-plugin-wrroc/.github/workflows/ci.yml new file mode 100644 index 0000000..e9a18aa --- /dev/null +++ b/snakemake-report-plugin-wrroc/.github/workflows/ci.yml @@ -0,0 +1,94 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + +env: + PYTHON_VERSION: 3.11 + +jobs: + formatting: + runs-on: ubuntu-latest + steps: + - name: Check out the code + uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + with: + python-version: ${{ env.PYTHON_VERSION }} + + - name: Install poetry + run: pip install poetry + + - name: Determine dependencies + run: poetry lock + + - uses: actions/setup-python@v4 + with: + python-version: ${{ env.PYTHON_VERSION }} + cache: poetry + + - name: Install Dependencies using Poetry + run: poetry install + + - name: Check formatting + run: poetry run black --check . + + linting: + runs-on: ubuntu-latest + steps: + - name: Check out the code + uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + with: + python-version: ${{ env.PYTHON_VERSION }} + + - name: Install poetry + run: pip install poetry + + - name: Determine dependencies + run: poetry lock + + - uses: actions/setup-python@v4 + with: + python-version: ${{ env.PYTHON_VERSION }} + cache: poetry + + - name: Install Dependencies using Poetry + run: poetry install + + - name: Check code + run: poetry run flake8 + + testing: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + with: + python-version: ${{ env.PYTHON_VERSION }} + + - name: Install poetry + run: pip install poetry + + - name: Determine dependencies + run: poetry lock + + - uses: actions/setup-python@v4 + with: + python-version: ${{ env.PYTHON_VERSION }} + cache: poetry + + - name: Install dependencies + run: poetry install + + - name: Run pytest + run: poetry run coverage run -m pytest tests/tests.py + + - name: Run Coverage + run: poetry run coverage report -m diff --git a/snakemake-report-plugin-wrroc/.github/workflows/conventional-prs.yml b/snakemake-report-plugin-wrroc/.github/workflows/conventional-prs.yml new file mode 100644 index 0000000..c777f4b --- /dev/null +++ b/snakemake-report-plugin-wrroc/.github/workflows/conventional-prs.yml @@ -0,0 +1,16 @@ +name: PR +on: + pull_request_target: + types: + - opened + - reopened + - edited + - synchronize + +jobs: + title-format: + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v3.4.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/snakemake-report-plugin-wrroc/.github/workflows/release-please.yml b/snakemake-report-plugin-wrroc/.github/workflows/release-please.yml new file mode 100644 index 0000000..faba04e --- /dev/null +++ b/snakemake-report-plugin-wrroc/.github/workflows/release-please.yml @@ -0,0 +1,53 @@ +on: + push: + branches: + - main + +name: release-please + +env: + PYTHON_VERSION: 3.11 + +jobs: + release-please: + runs-on: ubuntu-latest + outputs: + release_created: ${{ steps.release.outputs.release_created }} + steps: + - uses: GoogleCloudPlatform/release-please-action@v3 + id: release + with: + release-type: python + package-name: snakemake-report-plugin-wrroc + + publish: + runs-on: ubuntu-latest + needs: release-please + if: ${{ needs.release-please.outputs.release_created }} + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + with: + python-version: ${{ env.PYTHON_VERSION }} + + - name: Install poetry + run: pip install poetry + + - name: Determine dependencies + run: poetry lock + + - uses: actions/setup-python@v4 + with: + python-version: ${{ env.PYTHON_VERSION }} + cache: poetry + + - name: Install Dependencies using Poetry + run: | + poetry install + + - name: Publish to PyPi + env: + PYPI_USERNAME: __token__ + PYPI_PASSWORD: ${{ secrets.PYPI_TOKEN }} + run: poetry publish --build --username $PYPI_USERNAME --password $PYPI_PASSWORD diff --git a/snakemake-report-plugin-wrroc/README.md b/snakemake-report-plugin-wrroc/README.md new file mode 100644 index 0000000..e69de29 diff --git a/snakemake-report-plugin-wrroc/dist/snakemake_report_plugin_wrroc-0.1.0-py3-none-any.whl b/snakemake-report-plugin-wrroc/dist/snakemake_report_plugin_wrroc-0.1.0-py3-none-any.whl new file mode 100644 index 0000000000000000000000000000000000000000..ffaaf35538bbfe55bce122358d2b724d9f027f65 GIT binary patch literal 2555 zcmb7GcTm&W7XA?kQKU%|kSa(K2%&`l(hV&@0BHgmBhrOH=wgFaz#sxbLXln+=`BhZ z5RtA_>1C->1f_|z&F;>;H~MDZd)_-|?#%t;eBYe&oim>aikgNE0DxnZ5CpKM4){zO z0AN1>0OFJ%Zx5`SgF7WKcn41$-Us7(!`I2h1LKd!cD^({Q#Xd~C%x}t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HZ zWCcOF9JBrwTk>mLhHU1;@b=nBP;?KZ9*4lCZQlyx9>y<4`q$}H;xaQGAE}Jr^|tuh z4jLkG=@)3Eybk0JRm%nwX4)mbz>_8WNzU7mWKK-u6cbi0?9;QI)znO>stj<$Wq%~{ zklwmak=g0!d|K0DUg!{g+uVI}6pHtFOw-ui(sMI}2;vw?;~4wh`ETd^ck$!*!P)uS z55MI8=ehg;;b5?L|1+KpM(+IgE%3gnh=ae@m+vz+3Z|?^f=FE{u80iw!I$R$9G;H*VpmA zqaoe1cfV%r-X*=|fn!@17xh=U;4hc&X1K#|eVXX8U-!er?o^lUH@U#F>008>$07w7; literal 0 HcmV?d00001 diff --git a/snakemake-report-plugin-wrroc/poetry.lock b/snakemake-report-plugin-wrroc/poetry.lock new file mode 100644 index 0000000..b149307 --- /dev/null +++ b/snakemake-report-plugin-wrroc/poetry.lock @@ -0,0 +1,61 @@ +# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. + +[[package]] +name = "argparse-dataclass" +version = "2.0.0" +description = "Declarative CLIs with argparse and dataclasses" +optional = false +python-versions = ">=3.8" +files = [ + {file = "argparse_dataclass-2.0.0-py3-none-any.whl", hash = "sha256:3ffc8852a88d9d98d1364b4441a712491320afb91fb56049afd8a51d74bb52d2"}, + {file = "argparse_dataclass-2.0.0.tar.gz", hash = "sha256:09ab641c914a2f12882337b9c3e5086196dbf2ee6bf0ef67895c74002cc9297f"}, +] + +[[package]] +name = "configargparse" +version = "1.7" +description = "A drop-in replacement for argparse that allows options to also be set via config files and/or environment variables." +optional = false +python-versions = ">=3.5" +files = [ + {file = "ConfigArgParse-1.7-py3-none-any.whl", hash = "sha256:d249da6591465c6c26df64a9f73d2536e743be2f244eb3ebe61114af2f94f86b"}, + {file = "ConfigArgParse-1.7.tar.gz", hash = "sha256:e7067471884de5478c58a511e529f0f9bd1c66bfef1dea90935438d6c23306d1"}, +] + +[package.extras] +test = ["PyYAML", "mock", "pytest"] +yaml = ["PyYAML"] + +[[package]] +name = "snakemake-interface-common" +version = "1.17.2" +description = "Common functions and classes for Snakemake and its plugins" +optional = false +python-versions = "<4.0,>=3.8" +files = [ + {file = "snakemake_interface_common-1.17.2-py3-none-any.whl", hash = "sha256:ca5043ee707c071d9fed7e659df4803e8eeeaf1fe0d0bdb6716deb0141208748"}, + {file = "snakemake_interface_common-1.17.2.tar.gz", hash = "sha256:7a2bba88df98c1a0a5cec89b835c62dd2e6e72c1fb8fd104fe73405c800b87c0"}, +] + +[package.dependencies] +argparse-dataclass = ">=2.0.0,<3.0.0" +ConfigArgParse = ">=1.7,<2.0" + +[[package]] +name = "snakemake-interface-report-plugins" +version = "1.0.0" +description = "The interface for Snakemake report plugins." +optional = false +python-versions = ">=3.11,<4.0" +files = [ + {file = "snakemake_interface_report_plugins-1.0.0-py3-none-any.whl", hash = "sha256:e39cf2f27a36bda788dd97ede8fd056f887e00dca2d14ffea91dbc696d1f17cd"}, + {file = "snakemake_interface_report_plugins-1.0.0.tar.gz", hash = "sha256:02311cdc4bebab2a1c28469b5e6d5c6ac6e9c66998ad4e4b3229f1472127490f"}, +] + +[package.dependencies] +snakemake-interface-common = ">=1.16.0,<2.0.0" + +[metadata] +lock-version = "2.0" +python-versions = "^3.12" +content-hash = "5ef0075a4c44525781a793918fc6cbe3e0be535a62cb6923056ae1295388f7e1" diff --git a/snakemake-report-plugin-wrroc/pyproject.toml b/snakemake-report-plugin-wrroc/pyproject.toml new file mode 100644 index 0000000..227286a --- /dev/null +++ b/snakemake-report-plugin-wrroc/pyproject.toml @@ -0,0 +1,17 @@ +[build-system] +requires = [ "poetry-core",] +build-backend = "poetry.core.masonry.api" + +[tool.poetry] +name = "snakemake-report-plugin-wrroc" +version = "0.1.0" +description = "" +authors = [ "fbartusch ",] +readme = "README.md" +repository = "https://github.com/your/plugin" +documentation = "https://snakemake.github.io/snakemake-plugin-catalog/plugins/report/wrroc.html" + +[tool.poetry.dependencies] +python = "^3.12" +snakemake-interface-common = "^1.17.2" +snakemake-interface-report-plugins = "^1.0.0" diff --git a/snakemake-report-plugin-wrroc/setup.cfg b/snakemake-report-plugin-wrroc/setup.cfg new file mode 100644 index 0000000..43a5b43 --- /dev/null +++ b/snakemake-report-plugin-wrroc/setup.cfg @@ -0,0 +1,7 @@ +[flake8] +# Recommend matching the black line length (default 88), +# rather than using the flake8 default of 79: +max-line-length = 88 +extend-ignore = + # See https://github.com/PyCQA/pycodestyle/issues/373 + E203, \ No newline at end of file diff --git a/snakemake-report-plugin-wrroc/snakemake_report_plugin_wrroc/__init__.py b/snakemake-report-plugin-wrroc/snakemake_report_plugin_wrroc/__init__.py new file mode 100644 index 0000000..b7269e8 --- /dev/null +++ b/snakemake-report-plugin-wrroc/snakemake_report_plugin_wrroc/__init__.py @@ -0,0 +1,63 @@ +from dataclasses import dataclass, field +from typing import Optional + +from snakemake_interface_common.exceptions import WorkflowError # noqa: F401 +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-- +# 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__, 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": False, + }, + ) + + +# 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 # noqa: E501 + # 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. + print("test") + + # print basic information (start/end) of each job + for rec in self.jobs: + print("rule: " + rec.rule) + print("starttime: " + str(rec.starttime)) + print("endtime: " + str(rec.endtime)) + diff --git a/snakemake-report-plugin-wrroc/tests/tests.py b/snakemake-report-plugin-wrroc/tests/tests.py new file mode 100644 index 0000000..17e4f7c --- /dev/null +++ b/snakemake-report-plugin-wrroc/tests/tests.py @@ -0,0 +1,16 @@ +from typing import Optional +import snakemake.common.tests +from snakemake_interface_report_plugins.settings import ReportSettingsBase + + +# Check out the base classes found here for all possible options and methods: +# https://github.com/snakemake/snakemake/blob/main/snakemake/common/tests/__init__.py +class TestWorkflowsBase(snakemake.common.tests.TestReportBase): + __test__ = True + + def get_reporter(self) -> str: + return "wrroc" + + def get_report_settings(self) -> Optional[ReportSettingsBase]: + # instantiate ReportSettings of this plugin as appropriate + ...