Repository navigation
fix(jupyter): run {ggsql} cells; expand {resource_dir} in kernelspec argv - #864
Merged
Merged
Conversation
…elspec argv
Add ggsql to the jupyter engine's executable-language allowlist, so
{ggsql} blocks run on the ggsql kernel instead of passing through as
literal text.
runtimelib substitutes only {connection_file} in a kernelspec's argv,
but the Jupyter kernelspec contract also defines {resource_dir}, which
the ggsql kernelspec uses ({resource_dir}/ggsql-jupyter). Expand it
(absolutized) before spawning the kernel.
Known limitation: one kernel is chosen per document from the first
executable cell, so mixing {python} and {ggsql} still fails.
…i-kernel Replace the Jupyter engine's hard-coded language lists with resolver-assigned ownership (absorbing Plan 4d), Q1-style kernelspec lookup by language, and several kernels per document. Records the research, decisions, and open questions so far.
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
{ggsql}code blocks never ran underq2 render. The Jupyter engine passed them through as literal text, because it executes only the languages named in a hard-coded list. Once that list allowsggsql, a second defect appears: the kernel fails to start, because q2 never expands the{resource_dir}placeholder in the kernelspec'sargv. This PR fixes both. It also adds an outline for removing the language list altogether.The two fixes
is_executable_language(engine/jupyter/text_execute.rs) now includesggsql. The kernel name needs no mapping:map_language_to_kernelalready passes unknown language names through, and the ggsql kernelspec is namedggsql.{resource_dir}.runtimelibsubstitutes only{connection_file}inargv, but the Jupyter kernelspec contract also defines{resource_dir}(the kernelspec's own directory). The ggsql kernelspec launches{resource_dir}/ggsql-jupyter, so spawning failed withNo such file or directory.expand_resource_dir(engine/jupyter/daemon.rs) now expands it, using an absolute path. This applies to any kernel that uses the placeholder, not only ggsql.Known limitation
A document gets one kernel, chosen from its first executable cell. A document that mixes
{python}and{ggsql}therefore sends every cell to the first cell's kernel, and the other language's cells fail. Before this PR those ggsql cells were left unexecuted (or reported as unhandled in a multi-engine document), so this is a visible change in behavior for mixed documents.Longer-term fix (outline only)
The language allowlist is a stopgap. The resolver already assigns
ggsqlto the Jupyter engine, but the engine never receives that assignment. It receives only the set of languages to leave alone, so it cannot tell "mine" from "owned by nobody" and falls back on its own list.claude-notes/plans/2026-10-17-jupyter-owned-languages-epic.mdoutlines an epic that would:owned_languages);languagefield;The multi-kernel part is a stretch goal. It goes beyond Quarto 1, which runs one kernel per document, and it needs further design and discussion before anyone plans it in detail. The rest of the outline stands without it. The plan records what we verified, the decisions so far, and the open questions. It is an outline for review, not a commitment to this design.
Testing
ggsqlintest_is_executable_language, plus two tests forexpand_resource_dir(substitution; other args left alone).cargo clippy -p quarto-core --all-targets -- -D warningsis clean.cargo nextest run -p quarto-corepassed (6300 tests) before the final review fixes; after them I re-ran only the 109 jupyter tests.q2 render --strictpasses on the plan file.@icarusz