-
Notifications
You must be signed in to change notification settings - Fork 349
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
FR: set QUARTO_DOCUMENT_FILE
to the path of the input file
#12271
Conversation
7731a84
to
7ed6a03
Compare
I like this, but we need to do a different implementation. As we move towards parallelism, we will need to stop depending on the current environment for things that will change depending on the document. Instead, we should change the code to make it so that enough information exists at the point of spawning a subprocess call to make the environment of each subprocess different. I can explain more in our engineering meetings, but I don't think we should merge this PR as it stands. |
Always two steps ahead, thinking into the future! 😄 I was trying to add this as simply as possible for an easy new feature in the current state of the code. As it is useful information in addition to the existing environment variable. And me thinking it was an easy addition 🤦
😄 happy to put that on hold anyhow |
I was about to code exactly this, @cderv, coming from that issue, as it seemed simple enough. regarding the parallelism concerns, is the current version already doing this subprocess spawning ? |
There are some async happening, so it may be already not working as expected in some context. Though this is indeed simple enough, and we could live with this addition until we would change the all logic of where to set those env var. However, we still have an issue to understand right now before merging this because depending on context (singleFile or project) the content is either relative or absolute. So I am putting on hold right to also fix this. |
@cscheid I have looked into the difference between project render and singlefile render and the rev Both start with quarto-cli/src/command/render/cmd.ts Lines 247 to 251 in a88e7cc
However, when in a project, there will be some context compute which will end up normalizing (by adding back the quarto-cli/src/command/render/project.ts Lines 287 to 294 in a88e7cc
quarto-cli/src/command/render/project.ts Lines 150 to 168 in a88e7cc
So basically,
This is the different we see in those environment variable from this PR, as it will be inherited by quarto-cli/src/execute/environment.ts Line 16 in a88e7cc
It seems there is room for improvement to make things work the same. But do we want to do it in this PR? We could
|
7ed6a03
to
a88e7cc
Compare
…e so that execution engine can access it And add test for each engine we support
a88e7cc
to
d2cd890
Compare
This allows execution engine to access it
Related to discussion in #11606
And add test for each engine we support
While adding tests, I noticed two things:
options.projectDir
is always set now sincesingleFileProjectContext()
so we could simplify codebase maybe (see comment in code)QUARTO_DOCUMENT_PATH
does not output the same (using the absolute path for project and using a relative path for non-project)Example
I don't know if this is expected. Would be a breaking change to fix it for anyone already using this, but it feels like something that should output the same since aim is to consider everything as a project. User shouldn't have to know about singleFile vs project context.