quarto-dev / quarto-dev/quarto-cli
Unexpected behavior with parameters when using Jupyter
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 458
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
Description
Bug description
When specifying parameters via the CLI (for a document using Jupyter), if no default value is specified, the document will not render. If a single (even unrelated) parameter default is specified then it works which is unexpected behavior.
Steps to reproduce
For example running the follow results in an error as key1 is not found (get error: NameError: name 'key1' is not defined)
CLI command: quarto render test.qmd -P key1:value2
test.qmd
---
title: "Test"
format:
html: default
jupyter: python3
---
```{python}
#| tags: [parameters]
```
```{python}
print(key1)
```
However, the following code works (specifying a single default even if its a different key produces the desired functionality):
CLI command: quarto render test.qmd -P key1:value2
test.qmd
---
title: "Test"
format:
html: default
jupyter: python3
---
```{python}
#| tags: [parameters]
key5 = "value5"
```
```{python}
print(key1)
```
Expected behavior
I expect to not need to specify default values if I am passing them in through the CLI. Even if default values are required, it should require defaults for all values.
Actual behavior
Currently, any single default value being specified causes the document to render. This key/value default can be entirely unrelated to the key/value actually being access in the document but it still allows it to run which is unexpected.
Your environment
OS: Mac OS 14.3.1
Quarto check output
Quarto 1.4.542
[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.1.11: OK
Dart Sass version 1.69.5: OK
Deno version 1.37.2: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 1.4.542
Path: /Applications/quarto/bin
[✓] Checking tools....................OK
TinyTeX: v2022.08
Chromium: (not installed)
[✓] Checking LaTeX....................OK
Using: TinyTex
Path: /Users/trevornederlof/Library/TinyTeX/bin/universal-darwin
Version: 2022
[✓] Checking basic markdown render....OK
[✓] Checking Python 3 installation....OK
Version: 3.10.4
Path: /Users/trevornederlof/code/sample/api/.venv/bin/python3
Jupyter: 5.7.2
Kernels: python3
[✓] Checking Jupyter engine render....OK
[✓] Checking R installation...........OK
Version: 4.2.2
Path: /Library/Frameworks/R.framework/Resources
LibPaths:
- /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library
knitr: 1.39
rmarkdown: 2.14
[✓] Checking Knitr engine render......OK
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the CLI command and the two test.qmd examples from the report, using the Jupyter engine. Trace how the parameters block is handled when no defaults are declared. Done means a CLI-supplied key renders without a default, while unrelated defaults do not change the result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- jupyter, python
- Domain
- backend, cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100