Closed kpagacz closed 5 months ago
This comes from the design of how we recognize dependencies, utils::sessionInfo()$otherPkgs
.
https://github.com/insightsengineering/teal/blob/a0963efad810b5bf2f7e24c6abe2852366383d3f/R/get_rcode_utils.R#L41
I think we should leave it if there is no clever move to reduce the list of dependencies.
The static removal of packages which we think are not needed do not have to be stable as we could change sth in the future. teal.data
could be used e.g. to rise the connection.
On the other hand I could imagine that teal.slice
/shiny
/testthat
/... will be never used in the show R code.
dependencies <- utils::sessionInfo()$otherPkgs
# this process is dangerous
setdiff(dependencies, c("teal.X", "testthat"))
For sure there could be more advanced solutions, like specifying dependencies when chunks are built.
From @mhallal1
Please refer to the comments by @Polkas in https://github.com/insightsengineering/teal/issues/752#issuecomment-1313285773
We should not add blindly all library calls for each SHow R Code call. We have many options to add only needed dependencies, for each module.
linked to https://github.com/insightsengineering/teal.code/issues/93
Closing this one. We can't separate output-related and app-related libraries. We moving to the solution where we provide library
calls by evaluating them in teal_data
object.
teal_data() |> within({library(...)})
When running this example:
I noticed show r code attaches all the behind-the-scenes libraries which might not be needed