From faa86a240a38904202fec82de6a0a23bbf84e5cc Mon Sep 17 00:00:00 2001 From: Peter Van Dyken Date: Mon, 6 May 2024 09:07:53 -0400 Subject: [PATCH 1/3] Remove return from run method on Runner This results in the Runner __repr__ being printed when using app.run as an entrypoint --- snakebids/bidsapp/run.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snakebids/bidsapp/run.py b/snakebids/bidsapp/run.py index 44841ad6..8f883d1a 100644 --- a/snakebids/bidsapp/run.py +++ b/snakebids/bidsapp/run.py @@ -203,4 +203,4 @@ def run(self, args: list[str] | None = None): self.parse_args(args) self.pm.hook.run(config=self.config) self._run = True - return self + From 9dcf278c3379d7eed6ab8fde404c63c5bfbc29c0 Mon Sep 17 00:00:00 2001 From: Peter Van Dyken Date: Thu, 9 May 2024 12:45:42 -0400 Subject: [PATCH 2/3] Test that None returned by .run() --- snakebids/tests/test_bidsapp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snakebids/tests/test_bidsapp.py b/snakebids/tests/test_bidsapp.py index 321ead2c..9c9d8ecb 100644 --- a/snakebids/tests/test_bidsapp.py +++ b/snakebids/tests/test_bidsapp.py @@ -106,9 +106,9 @@ def test_parse_args(self): def test_run(self): app = bidsapp.app(plugins=[self]) - app.run(args=["default"]) + assert app.run(args=["default"]) is None assert self.hooks_run == 7 - app.run(args=["default"]) + assert app.run(args=["default"]) is None assert self.hooks_run == 7 From 81c3f86f05721d8cb7532d2918f39a9dc6911b5a Mon Sep 17 00:00:00 2001 From: Peter Van Dyken Date: Thu, 9 May 2024 12:50:48 -0400 Subject: [PATCH 3/3] fix types in snakemake_compat --- snakebids/bidsapp/run.py | 1 - snakebids/snakemake_compat.pyi | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/snakebids/bidsapp/run.py b/snakebids/bidsapp/run.py index 8f883d1a..93c7cf5b 100644 --- a/snakebids/bidsapp/run.py +++ b/snakebids/bidsapp/run.py @@ -203,4 +203,3 @@ def run(self, args: list[str] | None = None): self.parse_args(args) self.pm.hook.run(config=self.config) self._run = True - diff --git a/snakebids/snakemake_compat.pyi b/snakebids/snakemake_compat.pyi index 0809f11d..0d5fd9b0 100644 --- a/snakebids/snakemake_compat.pyi +++ b/snakebids/snakemake_compat.pyi @@ -1,9 +1,12 @@ from argparse import ArgumentParser from pathlib import Path +from types import ModuleType from typing import Any, Callable, Iterable, Sequence from snakemake.common import configfile as configfile # type: ignore +configfile: ModuleType + class WildcardError(Exception): ... def load_configfile(configpath: str) -> dict[str, Any]: