Skip to content

open shiny dev server in browser and probe readiness - #265

Draft
maxheld83 wants to merge 4 commits into
mainfrom
maxheld83-shiny-fixture-open-browser
Draft

maxheld83 wants to merge 4 commits into
mainfrom
maxheld83-shiny-fixture-open-browser

Conversation

@maxheld83

Copy link
Copy Markdown
Contributor

Improves the Shiny dev server served by shiny / pc-up-r-shiny.

  • Browser: runApp(launch.browser = <fn>) calls utils::browseURL() with the actual URL and writes it to $NULLKOMMA_PROCESSES/shiny/url. Shiny's Listening on … line shows the URL in the process log. The task sets a default R_BROWSER (open/xdg-open), because Nixpkgs' R leaves it empty. nix run .#shiny does not open a browser.
  • Reload: the existing autoreload is kept. The watcher package is added, as Shiny recommends for autoreload.
  • Alive indicator: a process-compose readiness_probe (exec + curl against the recorded URL) shows Ready/NotReady in the TUI. A very high failure_threshold makes the probe report status only; process-compose stops a process when the threshold is reached.
  • Fixture: tests/fixtures/r-shiny-hello contains Shiny's Old Faithful example. The dev task try-shiny serves it from a scratch copy with pc-up-r-shiny so you can try it by hand.
  • Tests: the r-shiny check now asserts the browser launch, the readiness probe passing and failing, and reload after an edit. A unit test evaluates the hello fixture.

tasks all and nix flake check pass on aarch64-darwin.

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