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

shinyApp chunk in vignettes only runs if is in interactive mode #741

Merged
merged 4 commits into from
Apr 24, 2024

Conversation

averissimo
Copy link
Contributor

@averissimo averissimo commented Apr 23, 2024

Pull Request

Changes description

  • add eval=base::interactive() to chunk options in vignettes

How to test

  • Run rmcdcheck::rmcdcheck()
  • Run scheduled.yaml Github action and all strategies complete successfully
    • Currently they're taking 6h+ hours and failing
    • Badge for this branch: Scheduled 🕰️

Copy link
Contributor

github-actions bot commented Apr 23, 2024

Unit Tests Summary

  1 files   22 suites   10m 42s ⏱️
147 tests 147 ✅ 0 💤 0 ❌
478 runs  478 ✅ 0 💤 0 ❌

Results for commit 67392cd.

♻️ This comment has been updated with latest results.

Copy link
Contributor

github-actions bot commented Apr 23, 2024

Unit Test Performance Difference

Test Suite $Status$ Time on main $±Time$ $±Tests$ $±Skipped$ $±Failures$ $±Errors$
shinytest2-tm_variable_browser 💔 $47.98$ $+1.78$ $0$ $0$ $0$ $0$

Results for commit d8739f8

♻️ This comment has been updated with latest results.

@averissimo averissimo requested a review from a team April 23, 2024 13:30
@pawelru
Copy link
Contributor

pawelru commented Apr 23, 2024

This looks good. I two comments:

  • can you please check whether runtime: shiny is required. I actually have no idea what it does
  • (assuming we already depend on rlang) have you considered rlang::is_interactive(). This is the function I have discovered quite recently and I don't know whether this is really better than the one from base.

@averissimo
Copy link
Contributor Author

runtime: shiny

  • can you please check whether runtime: shiny is required. I actually have no idea what it does

BLUF: It's not necessary and it does nothing in this case. I'm removing it.

Some context

It does not allow a ShinyApp though. Hence why it does nothing here.

When this runtime is set to shiny it allows for shiny elements on the rendered markdown (but not on pkgdown sites)

(from docs) The runtime target for rendering. The static option produces output intended for static files; shiny produces output suitable for use in a Shiny document (see run). The default, auto, allows the runtime target specified in the YAML metadata to take precedence, and renders for a static runtime target otherwise.

image

rlang::is_interactive()

  • (assuming we already depend on rlang) have you considered rlang::is_interactive(). This is the function I have discovered quite recently and I don't know whether this is really better than the one from base.

No practical benefits here, but rlang::is_interactive() is technically better as it will detect the right context . Unlike, base::interactive that only detects if there is an interactive session.

When can it be helpful?

  1. Forcing the result to be either value (via global option)
  2. Manual running knitr or testthat in a console
    • rlang::is_interactive() as FALSE, where base version is TRUE

image

image

@averissimo
Copy link
Contributor Author

averissimo commented Apr 23, 2024

The {verdepcheck} GitHub workflow ran successfully

This PR should also fix the GRAN and r-universe build fails.

Copy link
Contributor

@pawelru pawelru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@averissimo averissimo merged commit 272835d into main Apr 24, 2024
29 checks passed
@averissimo averissimo deleted the 740-vignettes-shinyapp@main branch April 24, 2024 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Vignettes have a shinyApp call that makes rcmdcheck() run forever GRAN fail build
3 participants