diff --git a/docs/developing_a_pheval_plugin.md b/docs/developing_a_pheval_plugin.md index d069caf2d..c63f56643 100644 --- a/docs/developing_a_pheval_plugin.md +++ b/docs/developing_a_pheval_plugin.md @@ -19,7 +19,7 @@ The plugin goal is to be flexible through custom runner implementations. This pl ## Step-by-Step Plugin Development Process The plugin structure is derived from a [cookiecutter](https://cookiecutter.readthedocs.io/en/stable/) template, [Sphintoxetry-cookiecutter](https://github.com/hrshdhgd/sphintoxetry-cookiecutter), and it uses [Sphinx](https://www.sphinx-doc.org/en/master/), [tox](https://tox.wiki/en/latest/) and [poetry](https://python-poetry.org) as core dependencies. -This allows PhEval extensibility to be standardized in terms of documentation and dependency management. +This allows PhEval extensibility to be standardised in terms of documentation and dependency management. ### 1. Sphintoxetry-cookiecutter scaffold @@ -36,7 +36,7 @@ pip install cruft Next, create a project using the sphintoxetry-cookiecutter template. ``` -cruft create https://github.com/monarch-initiative/monarch-project-template +cruft create https://github.com/monarch-initiative/pheval-runner-template ``` ### 2. Further setup @@ -53,12 +53,6 @@ pip install poetry poetry install ``` -#### Add PhEval dependency - -``` -poetry add pheval -``` - #### Run tox to see if the setup works ``` @@ -67,22 +61,19 @@ poetry run tox ### 3. Implement PhEval Custom Runner -_The runner name is arbitrary and custom Runner name was chose by demonstrative purposes_ - -Create a runner file inside the plugin project, e.g: - -![a](./imgs/plugin_example_folder_structure.png) - +In the project structure generated by Cookiecutter, you'll find `runner.py` located in the `src` directory. This is where you'll define the methods required to develop the plugin. Specifically, you'll implement the prepare, run, and post-process methods, which are essential for executing the pheval run command. ```python -"""Custom Pheval Runner.""" +"""Runner.""" + from dataclasses import dataclass from pathlib import Path + from pheval.runners.runner import PhEvalRunner @dataclass -class CustomPhevalRunner(PhEvalRunner): - """CustomPhevalRunner Class.""" +class CustomRunner(PhEvalRunner): + """Runner class implementation.""" input_dir: Path testdata_dir: Path @@ -92,29 +83,31 @@ class CustomPhevalRunner(PhEvalRunner): version: str def prepare(self): - """prepare method.""" + """Prepare.""" print("preparing") def run(self): - """run method.""" - print("running with custom pheval runner") + """Run.""" + print("running") def post_process(self): - """post_process method.""" + """Post Process.""" print("post processing") ``` -### 4. Add PhEval Plugins section to the pyproject.toml file + +The Cookiecutter will automatically populate the plugins section in the `pyproject.toml` file. If you decide to modify the path of `runner.py` or rename its class, be sure to update the corresponding entries in this section accordingly: ```toml [tool.poetry.plugins."pheval.plugins"] -customrunner = "pheval_plugin_example.runner:CustomPhevalRunner" +customrunner = "pheval_plugin_example.runner:CustomRunner" ``` -==Replace the value above with the path to your custom runner plugin== +> Please Note that the path here and naming of the class is case sensitive. + -### 5. Implementing PhEval helper methods +### 4. Implementing PhEval helper methods Streamlining the creation of your custom PhEval runner can be facilitated by leveraging PhEval's versatile helper methods, where applicable. diff --git a/docs/imgs/plugin_example_folder_structure.png b/docs/imgs/plugin_example_folder_structure.png deleted file mode 100644 index 69ced8daf..000000000 Binary files a/docs/imgs/plugin_example_folder_structure.png and /dev/null differ