From 11d4dc88598ffb901450bd4e076b91f4e27d37b0 Mon Sep 17 00:00:00 2001 From: Lars Bilke Date: Fri, 28 Jan 2022 17:37:31 +0100 Subject: [PATCH] fix: Draft notebook filename with wildcards and params. (#1352) * fix: Draft notebook filename with wildcards and params. Closes #1351. * fix: report generation with notebook wildcards / params. --- snakemake/notebook.py | 2 ++ snakemake/report/__init__.py | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/snakemake/notebook.py b/snakemake/notebook.py index f946fe0d2..8d87b6259 100644 --- a/snakemake/notebook.py +++ b/snakemake/notebook.py @@ -13,6 +13,7 @@ from snakemake.common import is_local_file from snakemake.common import ON_WINDOWS from snakemake.sourcecache import SourceCache, infer_source_file +from snakemake.utils import format KERNEL_STARTED_RE = re.compile(r"Kernel started: (?P\S+)") KERNEL_SHUTDOWN_RE = re.compile(r"Kernel shutdown: (?P\S+)") @@ -262,6 +263,7 @@ def notebook( Load a script from the given basedir + path and execute it. """ draft = False + path = format(path, wildcards=wildcards, params=params) if edit is not None: if is_local_file(path): if not os.path.isabs(path): diff --git a/snakemake/report/__init__.py b/snakemake/report/__init__.py index f65d303f6..8fe5c2cf8 100644 --- a/snakemake/report/__init__.py +++ b/snakemake/report/__init__.py @@ -281,7 +281,11 @@ def code(self): self._rule.notebook ): _, source, language, _ = script.get_source( - self._rule.notebook, self._rule.workflow.sourcecache, self._rule.basedir + self._rule.notebook, + self._rule.workflow.sourcecache, + self._rule.basedir, + wildcards=self.wildcards, + params=self.params, ) language = language.split("_")[1] sources = notebook.get_cell_sources(source)