quarto-dev / quarto-dev/quarto-cli
Quarto execution output ignores cell magics
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 458
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
Description
Bug description
Output of cell magics is ignored (in some cases).
Note, in some cases the output is shown, e.g. when using memory_profiler's %memit.
I guess it depends on how the magic is implemented.
Steps to reproduce
Use test.qmd with content
---
title: "Quarto Basics"
format: pdf
jupyter: python3
---
```{python}
#| echo: false
#| output: true
import re
print("While it outputs print statements, it doesn't output all cell magics")
%psource re.compile
```
and run via
quarto preview test.qmd --no-browser
Expected behavior
The output of the %psource magic should be displayed as it is in the jupyter notebook.
I.e. I expect to see
def compile(pattern, flags=0):
"Compile a regular expression pattern, returning a Pattern object."
return _compile(pattern, flags)
Actual behavior
%psource output is not displayed
Your environment
- VSCode: 1.92.0
- quarto runs on debian bookworm in a devcontainer on MacOS
Quarto check output
# quarto check
Quarto 1.5.54
[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.2.0: OK
Dart Sass version 1.70.0: OK
Deno version 1.41.0: OK
Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 1.5.54
Path: /opt/quarto/bin
[✓] Checking tools....................OK
TinyTeX: v2024.07.03
Chromium: (not installed)
[✓] Checking LaTeX....................OK
Using: TinyTex
Path: /root/.TinyTeX/bin/x86_64-linux
Version: 2024
[✓] Checking basic markdown render....OK
[✓] Checking Python 3 installation....OK
Version: 3.12.4 (Conda)
Path: /opt/conda/bin/python
Jupyter: 5.7.2
Kernels: python3
[✓] Checking Jupyter engine render....OK
[✓] Checking R installation...........(None)
Unable to locate an installed version of R.
Install R from https://cloud.r-project.org/
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 with the supplied test.qmd reproduction and run quarto preview test.qmd --no-browser, comparing the rendered result with the expected notebook output. Trace how Python cell-magic output is handled during Quarto's Jupyter execution, and consider the issue done when %psource output is displayed while existing print and %memit behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- jupyter, python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100