Skip to content

fix(py): unbreak _viz_tools import, legible dark-mode SQL editor - #328

Closed
cpsievert wants to merge 4 commits into
feat/maps-capability-pyfrom
fix/dark-mode-sql-editor
Closed

cpsievert wants to merge 4 commits into
feat/maps-capability-pyfrom
fix/dark-mode-sql-editor

Conversation

@cpsievert

Copy link
Copy Markdown
Contributor

Summary

Two fixes from the 2026-10-14 maps smoke test (_dev/maps-spatial-findings-2026-10-14.md):

  1. Unbreak querychat._viz_tools import on this branch. A previous commit on feat/maps-capability-py made viz_dep() use a dep_version() helper whose definition was never committed, so importing querychat._viz_tools raises ImportError and the Python CI job on feat(py): opt-in "maps" capability for visualizations #323 fails at collection time. This restores the direct __version__ usage.

  2. Light-on-light SQL in dark mode (rough edge fix: No longer need to manually calls session$ns() with shinychat #10). viz.css forced background-color: var(--bs-light) on .prism-code-editor inside .querychat-query-section, so in dark mode the github-dark syntax theme's light text rendered on a forced light background — illegible. The override is removed so the active prism theme's --editor__bg applies (github-light #fff / github-dark #0d1117); shiny's code editor already live-switches themes with data-bs-theme. This affected both the viz footer's "Show Query" editor and the data drawer's SQL editor, which share the .querychat-query-section wrapper.

Verification

  • ruff check, pyright, pytest (1018 passed) all green.
  • Dark-mode fix verified in a live browser with a minimal app using the real viz.css: dark mode → editor bg rgb(13, 17, 23) with rgb(230, 237, 243) text; light mode → rgb(255, 255, 255) with rgb(36, 41, 46) text; live switching via input_dark_mode works.

A previous commit on this branch made viz_dep() use a dep_version()
helper whose definition was never committed, so importing
querychat._viz_tools raised ImportError and the Python CI job on #323
failed at collection time. Restore the direct __version__ usage.
viz.css forced background-color: var(--bs-light) on .prism-code-editor
inside .querychat-query-section, so in dark mode the github-dark syntax
theme's light text rendered on a forced light background (light-on-light,
illegible). Drop the override so the active prism theme's --editor__bg
applies (github-light #fff / github-dark #0d1117); shiny's code editor
already switches themes with data-bs-theme.

Affects both the viz footer's "Show Query" editor and the data drawer's
SQL editor, which share the .querychat-query-section wrapper.
The previous commit edited the generated pkg-py copy of viz.css
directly; the source of truth is js/src/viz.css, which also feeds
pkg-r/inst/htmldep/viz.css.
@cpsievert
cpsievert marked this pull request as ready for review October 15, 2026 15:23
@cpsievert

Copy link
Copy Markdown
Contributor Author

Superseded: the _viz_tools import fix went directly onto feat/maps-capability-py (c9b3967), and the dark-mode CSS fix will be re-proposed as a new PR based on main, since the bug exists there too.

@cpsievert cpsievert closed this Oct 15, 2026
@cpsievert
cpsievert deleted the fix/dark-mode-sql-editor branch October 15, 2026 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant