fix: move required Shiny app packages from Suggests to Imports#1209
fix: move required Shiny app packages from Suggests to Imports#1209
Conversation
ed8b5e1 to
c468a8a
Compare
Move packages that are required for run_app() from Suggests to Imports
so they are installed automatically with install.packages('aNCA').
Moved to Imports: bslib, htmltools, htmlwidgets, logger,
reactable, reactable.extras, shiny, shinycssloaders, shinyjs,
shinyjqui, shinyWidgets, zip.
Removed stringi dependency entirely, replaced with base R
paste0(sample()) for random string generation.
Simplified check_app_dependencies() since all core app packages
are now guaranteed by Imports.
Co-authored-by: Ona <no-reply@ona.com>
81ec0c6 to
5d22712
Compare
later is always available when shiny is installed. No need to list it explicitly in DESCRIPTION. Co-authored-by: Ona <no-reply@ona.com>
5d22712 to
7c6d173
Compare
Wrap sessionInfo() rendering in tryCatch so the About tab doesn't crash when optional packages have missing or broken DESCRIPTION files. Co-authored-by: Ona <no-reply@ona.com>
Adds data-raw/test_suggests_hidden.R which hides all Suggests packages and launches run_app() to verify core functionality works without them. Already excluded from the package build via .Rbuildignore. Co-authored-by: Ona <no-reply@ona.com>
Added checklist item for running test_suggests_hidden.R when dependencies change.
Co-authored-by: Ona <no-reply@ona.com>
R CMD check requires every Imports package to have at least one importFrom in NAMESPACE. These packages are used in inst/shiny/ which R CMD check does not scan. Co-authored-by: Ona <no-reply@ona.com>
…-imports-classification
…//github.com/pharmaverse/aNCA into 1207-bug/fix-suggests-imports-classification
js3110
left a comment
There was a problem hiding this comment.
Hey, looks good. I am getting two additional warning messages when I run with the hidden pacakges:
Warning in FUN(X[[i]], ...) :
DESCRIPTION file of package 'shinytest2' is missing or broken
Warning message:
In read.dcf(file.path(p, "DESCRIPTION"), c("Package", "Version")) :
cannot open compressed file '/AppData/Local/R/win-library/4.4/knitr/DESCRIPTION', probable reason 'No such file or directory'
This type of messages are for now expected, should not be a problem in the future
@js3110 This one on the other hand I am not completely clear why it happens to you |
|
ok @Gero1999 , idk either but everyting still works anyway, so I guess the warning messages can be ignored |
|
@billdenney feel free to check this PR if you have time |
|
@Gero1999 It does not work for me, I followed the how to test instructions and downloaded the zip file with all, but it didn't work: This bug of of downloading a htm file is annoying, we should fix this globally by a try catch... |
Build session info manually with per-package tryCatch instead of relying on print.sessionInfo(), which crashes when packages have missing or broken DESCRIPTION files. Co-authored-by: Ona <no-reply@ona.com>
Wrap sessionInfo() in .export_session_info() with tryCatch so a package with a broken DESCRIPTION file does not prevent the entire ZIP from being created. Co-authored-by: Ona <no-reply@ona.com>
|
@Shaakon35 Some exportable objects (PPT, session_info) are indeed coming from the session_info.txt will still appear for the user, but it will have the error message that indicates that could not be done. I don't want to change it per ce because other branches are already modifying the way it behaves (as it might stop using the |

Issue
Closes #1207
Description
run_app()fails on a clean install because several packages required by the Shiny app are listed inSuggestsinstead ofImports. Users must manually installlogger,reactable.extras,shinyjqui, and others before the app can start.This PR reclassifies packages based on a full audit of usage across
R/andinst/shiny/:Moved from Suggests → Imports (required at app startup, no fallback possible):
bslib,htmltools,htmlwidgets,loggerreactable,reactable.extrasshiny,shinycssloaders,shinyjs,shinyjqui,shinyWidgetszipRemoved entirely:
stringi— only used for random string generation (2 calls). Replaced with base Rpaste0(sample(c(letters, 0:9), 5, replace = TRUE), collapse = "").Kept in Suggests (properly guarded with
requireNamespace()or dev/test-only):arrow,haven,readxl— guarded inR/readers.Rofficer,flextable— guarded ininst/shiny/functions/zip-utils.Rrlistings,ggh4x— guarded at point-of-usequarto— guarded inR/quarto-utils.Rcovr,DT,jsonlite,knitr,lintr,markdown,mockery,nestcolor,pak,rmarkdown,sass,scales,shinytest2,testthat,vdiffr,withrOther changes:
check_app_dependencies()now reads theImportsfield fromDESCRIPTIONautomatically instead of maintaining a hardcoded list.require(stringi)frominst/shiny/app.R.R/imports-shiny.Rwith@importFromdirectives for packages only used ininst/shiny/(required byR CMD check).tryCatchguard tosessionInfo()rendering in the About tab.data-raw/test_suggests_hidden.Rfor manual dependency testing.Definition of Done
install.packages("aNCA")installs all packages needed forrun_app()to work without additional steps.How to test
Use the manual test script in a fresh R session:
source("data-raw/test_suggests_hidden.R")This hides all
Suggestspackages, loads the package, and launchesrun_app(). Verify:After stopping the app, restore packages:
Contributor checklist
.scsschange was done, rundata-raw/compile_css.Rdata-raw/test_suggests_hidden.RNotes to reviewer
This is a dependency classification fix, not a behavior change. The app should function identically — the only difference is that
install.packages("aNCA")now pulls in everything needed forrun_app().The
stringireplacement uses base R'ssample()which is sufficient for generating unique module IDs.Version bump and NEWS entry still needed before merge.