-
Notifications
You must be signed in to change notification settings - Fork 83
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
Disallow deploying .qmd
files with rmd-*
app modes
#595
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unconvinced about the error when we have both Rmd and Qmd files.
R/bundle.R
Outdated
shinyQmdFiles <- sapply(file.path(appDir, qmdFiles), isShinyRmd) | ||
|
||
# Trying to deploy Quarto and R Markdown files simultaneously is an error. | ||
if (length(rmdFiles) > 0 && length(qmdFiles) > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should think about this error a bit more. It is possible to have a Quarto project that uses a document.Rmd
file. Similarly, it is possible to have a Quarto project with a notebook.ipynb
file.
It might be helpful if we captured an enumeration of file name collections and explained which combinations lead to different app modes, especially in the presence / non-presence of quartoInfo
.
Here's one example:
_quarto.yml
analysis.Rmd
playground.ipynb
What content type should be used when this code is deployed to Connect? Why?
Similarly, what about:
report.Rmd
with non-nilquartoInfo
Is this information more a signal to use Quarto or to use R Markdown?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, you raise a good point.
The app mode is inferred after we have put Quarto info into the format we desire, so by this point it's not clear whether it comes from running quarto inspect
or as metadata passed in from the Quarto package.
I'm not sure what Connect would do with the first example you provide.
We had been using quartoInfo
's presence as an indicator of user intent to deploy Quarto. If continue to rely on that signal, we could do something like the following.
- with
quartoInfo
:- App mode is
quarto-static
, orquarto-shiny
if anyshinyRmdFiles
orshinyQmdFiles
.
- App mode is
- without
quartoInfo
:- App mode is
rmd-static
orrmd-shiny
, as would have been otherwise detected - Any
qmdFiles
orshinyQmdFiles
results in an error?
- App mode is
(Thinking about this more. When Quarto renders R Markdown files, their chunk arguments are parsed as R Markdown would, I'm guessing.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, we should discuss tomorrow. I was about to make some changes, but I want to confirm we're on the same page before I do another round on this.
From a discussion today, the behavior of this code is going to change to the following:
This will allow users to deploy non- |
8036c59
to
7080f6f
Compare
@aronatkins Discovered another bug in this while working on slides. If you try to publish the "finished document" via the IDE, [Edit] I'm not sure if this is an IDE bug (e.g. "Don't include |
The Quarto app mode is not correctly assigned when an I'm duplicating this comment here so that discussion related to the PR itself can occur on the PR. When I deployed the Rmd file, it deployed with a Quarto app mode.
https://rsc.radixu.com/connect/#/apps/6cc07579-932b-430e-9399-fa3a3b67905b/info/5454 When I deployed without passing in |
The issue that @ChaitaC identified is due to a circular dependency in the way that In other words, deploying the same content with This might not actually be a bug — this might be the correct functionality. I'm going to explore the topic in this comment. The issue occurs due to the following structure, which occurs in quartoInfo <- inferQuartoInfo(
appDir = appDir,
appPrimaryDoc = appPrimaryDoc,
quarto = quarto,
metadata = metadata
)
logger("Inferring App mode and parameters")
appMode <- inferAppMode(
appDir = appDir,
appPrimaryDoc = appPrimaryDoc,
files = appFiles,
quartoInfo = quartoInfo)
appPrimaryDoc <- inferAppPrimaryDoc(
appPrimaryDoc = appPrimaryDoc,
appFiles = appFiles,
appMode = appMode) I'll describe the issue:
We want to allow users to deploy R Markdown documents as Quarto content. However, calling In other words, in this way of thinking I think this is already the case, as even before Quarto's introduction This doesn't mean that this is actually easy for users to understand, though. I'm not sure what the best way to proceed is. @aronatkins, do you have any thoughts? |
In my mind, specifying should always publish Quarto
It'd be very surprising as a user to specify a Quarto path and end up with a RMarkdown type document. |
If I understand correctly, in this case, passing in the I don't understand the first bullet point. Are you suggesting that we should force Quarto for R Markdown docs that output HTML, even if no Quarto arg is given? As the code is written right now, we can't do that without an explicit Quarto path, and we've tried to be careful about not changing the package's behavior in response to consistent inputs. [edit] mentioning @jthomasmock |
Yes, I think we'd rather throw an error on failure to treat as Quarto rather than silently publish as RMarkdown when the user specified Quarto.
Sorry for lack of context! In the YAML header:
|
One more piece of information: We have |
We could expand
|
Per our discussion in today's sync, I'm going to move the current discussion to a new GitHub issue, and this PR has solved the problem it set out to solve. |
# Conflicts: # NEWS.md
Intent
Previously, Quarto documents and projects would deploy as
rmd-static
orrmd-shiny
if they were deployed without Quarto info available (either via runningquarto inspect
or via themetadata
argument).With this PR,
rsconnect
will stop with an error if that condition occurs, and advise the user to pass the path to a Quarto binary to thequarto
argument.Fixes #594
Approach
Previously, we would infer one set of
rmdFiles
that would contain both Quarto and R Markdown files, and decide betweenrmd-*
andquarto-*
app modes based on the presence or absence ofquartoInfo
, which is the inferred Quarto info from either running Quarto Inspect or unpacking metadata.Now, we find
.Rmd
and.qmd
files separately. The list of file names is stored inrmdFiles
andqmdFiles
separately, and a logical vector of whether they'reruntime: shiny
is stored inshinyRmdFiles
andshinyQmdFiles
. We also look for^_quarto.y(a)?ml$
.A deployment requires Quarto if… I was going to write out the condition, but the code is more readable than English.
Any
.qmd
files make us require Quarto info. or, if we have Quarto-compatible files and a_quarto.yml
, we need Quarto info. In those cases, if we don't have it, we raise an error.After this point, we take the presence of the
quartoInfo
variable to determine whether we usequarto
orrmd
app modes, in each locations where we assign*-shiny
and*-static
. This still will let you deploy R Markdown files as Quarto content, but prevents you from deploying Quarto content as non-Quarto.The RStudio IDE was adding the line
PackageCleanBeforeInstall: Yes
to.Rproj
files for a while. Now it apparently removes that line. I committed the change, because it happened with every install of a package.Automated Tests
Three tests were added:
quarto-website-r
, leaving thequarto
argumentNULL
, and expect the error message.quarto-doc-none
, leaving thequarto
argumentNULL
, and expect the error message.test-reds/simple.Rmd
, passing inquarto
. Ensure that the manifest has thequarto-static
app mode andknitr
engine.QA Notes
Install this branch of
rsconnect
from the RStudio IDE.Quarto content in the
tests/testthat
directory should deploy correctly:Without passing the
quarto
argument, you should see an error:After testing, you'll want to go into the
tests/testthat/quarto-website-r
folder and remove thersconnect
folder that was created.Deploying an R Markdown document from the IDE with this version installed should still deploy with an R Markdown app mode. (I tested this myself, but it's good to verify in a different environment.)
Checklist
NEWS.md