-
Notifications
You must be signed in to change notification settings - Fork 347
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
Render fails for file in subdirectory for book with freeze #8894
Comments
I can reproduce, but removing I do think this is related to project render targets for books, as adding to I tried adding to project:
type: book
render:
- notebooks/r.qmd
book:
chapters:
- index.qmd I wonder if this should work... Otherwise, how to do make some .qmd resources render for book project if anything needs to be a chapter ? 🤔 Also, I can confirm it happens only in our R code as |
FYI: |
Thanks @mcanouil - it seems |
I looked into this a bit more.
So this is a regression from a recent change in 1.5, possibly in how project context is now computed So I looked for the breaking change, and this is at a28ac25 from merging PR @cscheid when rendering in a Book project, any file you call When doing quarto-cli/src/command/render/render-files.ts Line 204 in f9cdaa9
This is now in my debug testing
while before it was
I would like to confirm this is the expected value for you. I would have expected the root directory as the project dir for all files. Based on this, I'll adapt our R code which is not correct anyway with this new project context change. We use this information about project dir to set the working directory for R. We relied on Lines 241 to 243 in e41b4c9
The input pass to R s
and so it raises the R error when we do try to "fix" the path in R context quarto-cli/src/resources/rmd/rmd.R Lines 53 to 56 in e41b4c9
We can discuss this live if this is easier. Thanks for your input |
Adding some notes for later references about behavior I found while trying to understand this. Issue is we now always have a project, even for single file render. Doing the following would restore the previous behavior diff --git a/src/command/render/render-files.ts b/src/command/render/render-files.ts
index 35e7b49a7..961752920 100644
--- a/src/command/render/render-files.ts
+++ b/src/command/render/render-files.ts
@@ -223,7 +223,9 @@ export async function renderExecute(
dependencies: resolveDependencies,
libDir: context.libDir,
format: context.format,
- projectDir: context.project?.dir,
+ projectDir: !context.project.isSingleFile
+ ? context.project?.dir
+ : undefined,
cwd: flags.executeDir || dirname(normalizePath(context.target.source)),
params: resolveParams(flags.params, flags.paramsFile),
quiet: flags.quiet, So the bottom of the issue is deeper I think First, R code logic was built around single render file having no project context. We may need to revisit this for 1.5, knowing now any render will have a project context, and the quarto-cli/src/project/types/single-file/single-file.ts Lines 30 to 31 in a28ac25
This has impact on where R code should be executed from. Previous it was Deno.cwd() unless in a project. We discussed this previously but we need to settle on this now.
Then, for book project, if quarto-cli/src/project/project-context.ts Lines 252 to 259 in a28ac25
This will trigger the new single file context causing the issue here quarto-cli/src/command/render/render-shared.ts Lines 102 to 103 in a28ac25
So there is the question of this logic for books project, and the potential impact it can have on existing book project. Maybe the impact on R code is the only one. |
😞 wrong linking - sorry. I'll know what to do now and I'll push a fix |
This is fixed on |
Bug description
Rendering a file in a subdirectory from the project root fails:
Works fine if any of the following is changed:
type: book
->type: default
notebooks/r.qmd
is added to the chapter listing in_quarto.yml
freeze: auto
removedSteps to reproduce
Repo at: https://github.com/cwickham/book-freeze
Run:
Expected behavior
Should render the same as rendering from inside the subdirectory:
Actual behavior
Error as above.
Your environment
Quarto check output
The text was updated successfully, but these errors were encountered: