-
Notifications
You must be signed in to change notification settings - Fork 328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
knitr engine with python: output option ignored for object with _repr_html_ method #9389
Comments
I believe this is an issue with knitr or reticulate directly. CC. @cderv |
It's definitely an issue (or a "feature") from |
@machow I suggest your report this on |
@mcanouil or @cscheid can you say a little bit more about what quarto is doing, and how it relates to the code you shared? For example, the qmd has the option Edit: depending on quarto's intention for |
Indeed, "output" does not exist in
However, based on my understanding, the @cderv is clearly the one with the best understanding regarding this. |
Quarto isn't the one doing anything here. The interpretation of cell options is all handled by |
For posterity, I think the easiest workaround for people in this situation is using a semi-colon to suppress python output:
|
From So |
Sorry - I was off last week. This is definitely a reticulate issue. It is not handling the Not directly quarto related, but still a quarto issue in a way as Thanks for the report @machow - I'll open an issue in reticulate |
@cderv thanks for taking a look. I'm confused on why reticulate should hide this, when R in an Rmd + ggplot would produce the graph. test.Rmd ```{r, results="hide"}
library(ggplot2)
ggplot(mtcars, aes(cyl, mpg)) + geom_point()
```
Note that the graph is produced and included in the knitted output. RE @mcanouil 's point:
knitr provides a Is the point here that In any event, thanks everyone for being so patient with helping me get a feel for this (I'm going to step away from this issue now, since I use jupyter to execute 😎) |
Thanks a lot for your input. This is precious feedback! I'll be also happy if you stay around 😄 😉 Indeed, the Tables are not considered figures as of now, this will hide gt table in R for example ```{r, results="hide"}
library(gt)
gt(head(mtcars))
``` That is mainly why I thought a great_tables object in reticulate should be hidden like in R. reticulate provides an engine that skip a lot of knitr direct handling of evaluated output, so we can adapt differently for python, or try to make it work the same. Hope this clarify a little what I meant. |
Bug description
When rendering a qmd with a mix of python and R code cells, the output option seems to be ignored for some objects. At first glance, it seems like it's ignored for objects with IPython display hooks (e.g.
_repr_html_
).Steps to reproduce
The qmd below was provided by @AlbertRapp (and tweaked a bit to reduce to anything with
_repr_html_
) in posit-dev/great-tables#291.Note that output is respected in some cases, but not in others.
Expected behavior
No output is shown for cells with output set to false
Actual behavior
Output is shown for objects with a
._repr_html_()
methodYour environment
Mac OS 14.4.1
Quarto check output
Quarto 1.4.549 [✓] 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.549 Path: /Applications/quarto/bin [✓] Checking tools....................OK TinyTeX: (not installed) Chromium: (not installed) [✓] Checking LaTeX....................OK Tex: (not detected) [✓] Checking basic markdown render....OK [✓] Checking Python 3 installation....OK Version: 3.10.11 Path: /Users/machow/.pyenv/versions/3.10.11/bin/python3 Jupyter: (None) Jupyter is not available in this Python installation. Install with python3 -m pip install jupyter R scripting front-end version 4.1.2 (2021-11-01) [✓] Checking R installation...........(None) Unable to locate an installed version of R. Install R from https://cloud.r-project.org/
The text was updated successfully, but these errors were encountered: