Skip to content
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

Epic: single source of truth for document/project information #8700

Open
2 of 14 tasks
Tracked by #8718
cscheid opened this issue Feb 12, 2024 · 10 comments
Open
2 of 14 tasks
Tracked by #8718

Epic: single source of truth for document/project information #8700

cscheid opened this issue Feb 12, 2024 · 10 comments
Labels
epic An issue that contains other issues
Milestone

Comments

@cscheid
Copy link
Collaborator

cscheid commented Feb 12, 2024

A number of bugs in Quarto happen because different parts of the code are responsible for reasoning about a .qmd document. We should have a single source of truth on this, and that should be what drives the output of, for example,quarto inspect.

This is related (but simpler) to our Execution Planner, and solving this will make it easier to do the planner well.

Resolution of CLI parameters into metadata or pandoc args

format configuration

include shortcode resolution

See also:

@cscheid cscheid added the epic An issue that contains other issues label Feb 12, 2024
@icarusz icarusz mentioned this issue Feb 15, 2024
9 tasks
@cscheid cscheid added this to the Future milestone Jun 5, 2024
@jkrumbiegel
Copy link
Contributor

I see there's been some work in this direction, with the addition of the ProjectContext in #8771. For our users, both not being able to specify engine: julia in the _quarto.yml and not being able to use .jl script files specifying engine: julia are still annoying roadblocks that I'd like to remove. @cscheid could you tell me if you think this can be meaningfully done by an outside contributor, or are the necessary changes too intertwined with your larger refactoring plans for the code base? If it's possible, it would be great to get a rough idea from you which parts are missing.

I was looking at the fileExecutionEngine function. In principle, the logic seems relatively straightforward. If an engine is specified in either frontmatter or project, this should take precedence over "file claiming". An engine specified in the frontmatter should take precedence over one specified in the project. With your new ProjectContext, the information needed is already there. However, markdownExecutionEngine currently expects file claiming to have run before it, and I'm not sure which way this conflict should be resolved.

@cderv
Copy link
Collaborator

cderv commented Oct 1, 2024

not being able to specify engine: julia in the _quarto.yml

For reference, project wide engine setting is tracked at:

This is a limitation across engine currently I believe.

being able to use .jl script files specifying engine: julia

For script file, we started discussion at

Is this the same topic ?

I am just cross-referencing to keep track of related topics so that we can all follow.

@jkrumbiegel
Copy link
Contributor

Yes, thanks, should've just linked those again directly.

@cscheid
Copy link
Collaborator Author

cscheid commented Oct 1, 2024

@jkrumbiegel Yes, I definitely want to fix this. We're nearing a 1.6 release and won't have time to do this between now and then (we plan to release early November). But I would like to spend some time on this in 1.7. Could we revisit this then?

I hope to be able to split the work such that some of it can be tackled by the engine code directly (and so you should be able to implement it in the pure-Julia engine).

@jkrumbiegel
Copy link
Contributor

Ok sure, if there's nothing I could do now, let's revisit it in November. But I could also get started now if I had a rough outline how to approach these two issues. Whatever works better for you :)

@cscheid
Copy link
Collaborator Author

cscheid commented Oct 1, 2024

For our users, both not being able to specify engine: julia in the _quarto.yml

I think this one will be harder for you to fix, because it involves the code where we bind engines/"targets" to documents. It is pretty messy and mostly outside of an engine's responsibilities.

and not being able to use .jl script files specifying engine: julia are still annoying roadblocks that I'd like to remove.

I think this could be easier (barring unexpected snags in our codebase). I think this one is entirely a matter of implementing claimsFile in the Julia engine. For contrast with the knitr and jupyter engines, see:

claimsFile: (file: string, ext: string) => {
return kRmdExtensions.includes(ext.toLowerCase()) ||
isKnitrSpinScript(file);
},

claimsFile: (file: string, ext: string) => {
return kJupyterNotebookExtensions.includes(ext.toLowerCase()) ||
isJupyterPercentScript(file);
},

While the julia engine has:

claimsFile: (file: string, ext: string) => false,

When an engine claims a file, then it's also responsible for providing the converted markdown for that file. See eg the jupyter engine code:

} else if (isJupyterPercentScript(file)) {
return Promise.resolve(
asMappedString(markdownFromJupyterPercentScript(file)),
);

@jkrumbiegel
Copy link
Contributor

jkrumbiegel commented Oct 1, 2024

Hm are you saying I should check within claimsFile whether the percent script has a engine: julia setting? Because otherwise I can't claim jl files without it being a breaking change. That's why I didn't do it at the time.

To me it seems like a logic bug that engines can claim file types which happens before an engine: whatever setting can even be considered. Shouldn't it be the other way around, check for engine settings otherwise fall back to file type association?

@cscheid
Copy link
Collaborator Author

cscheid commented Oct 1, 2024

Because otherwise I can't claim jl files without it being a breaking change. That's why I didn't do it at the time.

I only now see that jupyter.ts claims .jl percent scripts. That does complicate things quite a bit. I now think that this is also a November conversation. Should we put something on the calendar so that we can have a discussion about it?

@jkrumbiegel
Copy link
Contributor

That would be nice. Should I send you an email?

@cscheid
Copy link
Collaborator Author

cscheid commented Oct 1, 2024

Yes, please: [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
epic An issue that contains other issues
Projects
None yet
Development

No branches or pull requests

3 participants