Skip to content

feat: add .page()/$page() methods wrapping shinychat's page_chat() - #291

Merged
cpsievert merged 5 commits into
chat-footer-extrasfrom
page-method
Sep 10, 2026
Merged

cpsievert merged 5 commits into
chat-footer-extrasfrom
page-method

Conversation

@cpsievert

@cpsievert cpsievert commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds a .page() method (Python, Core + Express) and $page() method (R) to QueryChat, wrapping shinychat's new page_chat() for full-window, chat-first apps. It complements .sidebar()/.ui() and is now presented as an option for "custom apps".

Design notes:

  • Python Core: new mod_page() module UI; page_chat() resolves the chat id against the module namespace, so .server() works unchanged.
  • Python Express: wraps shinychat.express.page_chat(), which owns the entire page — querychat's dependencies are injected via footer= (merged with any user footer), and the pre-namespaced chat id is passed as a ResolvedId to survive page_chat()'s internal resolve_id().
  • R: $page() factors querychat_dependency() out of mod_ui(); on both sides a user-supplied class is merged with the required querychat class.
  • Examples: new 03-page-core-app.py / 03-page-express-app.py put the reactive data view on a secondary chat_nav_panel() (Express uses ui.hold()); the R 10-viz-app example is converted to $page() for a chat-first layout.
  • Docs: "Chat-first page" sections in build.qmd and build.Rmd; changelog entries in both packages.

Verification

  • New unit tests: pkg-py/tests/test_page.py (8 tests) and a QueryChat$page() block in pkg-r/tests/testthat/test-QueryChat.R (7 tests).
  • New playwright smoke tests (test_03_page_apps.py, 6 tests) run both new example apps in a real browser — no API key needed.
  • Try it: shiny run pkg-py/examples/03-page-express-app.py, or in R: qc <- QueryChat$new(palmerpenguins::penguins); shinyApp(qc$page("Penguins"), \(...) qc$server()).

@cpsievert
cpsievert changed the base branch from main to chat-footer-extras September 10, 2026 00:01
Comment thread pkg-py/src/querychat/_shiny_module.py Resolved
@cpsievert
cpsievert marked this pull request as ready for review September 10, 2026 00:13
@cpsievert
cpsievert requested a lite review from Copilot September 10, 2026 00:13

This comment was marked as resolved.

cpsievert and others added 5 commits September 10, 2026 13:33
Full-window, chat-first app layouts for R, Python Core, and Python Express, with examples, docs, and tests. Extras (dependencies, handoff panel) ride in page_chat()'s footer slot via the helpers from the chat-footer-extras branch.
…class assertions

Addresses Copilot review feedback on #291.
shiny>=1.7.0 (the current floor) exports it publicly, so no
private-API fallback is needed.
shiny.module re-exports namespace_context at runtime (>= 1.7.0) but
omits it from __all__, so pyright flags the import. Suppress per-line
until shiny adds it to __all__.
@cpsievert
cpsievert added this pull request to stack #296 September 10, 2026 20:57
@cpsievert
cpsievert merged commit 38bcc85 into main Sep 10, 2026
18 of 23 checks passed
@cpsievert
cpsievert deleted the page-method branch September 10, 2026 22:30
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.

2 participants