Skip to content

Commit 9b7f5df

Browse files
authored
Merge pull request #12500 from quarto-dev/bugfix/11990
jupyter - do not echo cell with execution parameters.
2 parents ebc4b52 + ed59480 commit 9b7f5df

File tree

4 files changed

+45
-1
lines changed

4 files changed

+45
-1
lines changed

news/changelog-1.7.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ All changes included in 1.7:
1010
- ([#11659](https://github.com/quarto-dev/quarto-cli/pull/11659)): `julia` engine - Fix escaping bug where paths containing spaces or backslashes break server startup on Windows.
1111
- ([#11752](https://github.com/quarto-dev/quarto-cli/issues/11752)): Fix regression with non-alphanumeric characters in `categories` preventing correct filtering of listing.
1212
- ([#11943](https://github.com/quarto-dev/quarto-cli/issues/11943)): Fix callout title color on dark theme in revealjs following Revealjs update in quarto 1.6.
13+
- ([#11990](https://github.com/quarto-dev/quarto-cli/issues/11990)): Do not print parameter cell in parameterized Jupyter notebooks.
1314
- ([#12147](https://github.com/quarto-dev/quarto-cli/issues/12147)): for RevealJS format, `serif` and `simple` themes defaults back to have their heading color (`$presentation-heading-color`) to be the same as the body color (`$body-color`) as in Quarto 1.5.
1415

1516
## Dependencies

src/resources/jupyter/notebook.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,9 +686,11 @@ def nb_parameterize(nb, params):
686686
# and then re-encode it
687687
try:
688688
params_cell_yaml = parse_string("\n".join(params_cell_yaml))
689-
del params_cell_yaml['label']
689+
if "label" in params_cell_yaml:
690+
del params_cell_yaml['label']
690691
params_cell_yaml = safe_dump(params_cell_yaml).strip().splitlines()
691692
except Exception as e:
693+
sys.stderr.write(str(e) + "\naksjdfhakjsdhf\n")
692694
sys.stderr.write("\nWARNING: Invalid YAML option format in cell:\n" + "\n".join(params_cell_yaml) + "\n")
693695
sys.stderr.flush()
694696
params_cell_yaml = []
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
title: "Quarto Parameters"
3+
format: html
4+
engine: jupyter
5+
keep-md: true
6+
keep-ipynb: true
7+
---
8+
9+
```{python}
10+
#| tags: [parameters]
11+
#| include: false
12+
username = None
13+
password = None
14+
```
15+
16+
```{python}
17+
print(f"Hello, {username}!")
18+
```
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* issue-11990.test.ts
3+
*
4+
* https://github.com/quarto-dev/quarto-cli/issues/11990
5+
*
6+
* Copyright (C) 2025 Posit Software, PBC
7+
*/
8+
9+
import { join } from "../../../src/deno_ral/path.ts";
10+
import { docs, outputForInput } from "../../utils.ts";
11+
import { noErrorsOrWarnings, ensureFileRegexMatches } from "../../verify.ts";
12+
import { testRender } from "../render/render.ts";
13+
14+
const format = "html";
15+
const input = docs(join("jupyter", "parameters", "issue-11990.qmd"));
16+
const output = outputForInput(input, format);
17+
18+
testRender(input, format, false, [
19+
noErrorsOrWarnings,
20+
ensureFileRegexMatches(output.outputPath, [], [
21+
"Injected Parameters"
22+
]),
23+
], {}, ["--no-execute-daemon", "--execute-param", "username:John"]);

0 commit comments

Comments
 (0)