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

How do install the package in shinylive from github #15

Open
2 tasks done
stephenturner opened this issue Nov 27, 2024 · 4 comments
Open
2 tasks done

How do install the package in shinylive from github #15

stephenturner opened this issue Nov 27, 2024 · 4 comments
Labels
question Further information is requested

Comments

@stephenturner
Copy link

What is your question?

Super cool package and idea here. I'm trying to get this to work in a package that is only available on github. When I follow the docs, I get a packagedown page that opens up a shinylive browser, but it's blank, and when I hit the edit button, it can't find the package function when I try to run it. If I add a library(mylibname) to the examples, it still doesn't work because it can't find my package in the webR binary repo. Not sure how to get this to work.

> Warning in webr::install(pkg_name) :
  Requested package mypackagename not found in webR binary repo.

Code of Conduct

  • I agree to follow this project's Code of Conduct.

Contribution Guidelines

  • I agree to follow this project's Contribution Guidelines.
@stephenturner stephenturner added the question Further information is requested label Nov 27, 2024
@cicdguy
Copy link
Contributor

cicdguy commented Nov 28, 2024

Hey @stephenturner, where can we find your package? CC @pawelru

@pawelru
Copy link
Contributor

pawelru commented Nov 28, 2024

Hey @stephenturner thanks for the interest in the package!
The simplest and probably most robust way is to use CRAN only packages. WebR builds the wasm binaries for almost all the CRAN packages so this should work.
I also tried with r-universe and this should be possible as well with some extra workaround (I asked that question in some repo and got reply how to do this).
For GitHub unfortunately I haven't try so can't guide you here.
I'm afk now. Once I came back I can send you some references that could help you!

@stephenturner
Copy link
Author

Package is here, but this is just a toy package to demonstrate something else. There's only one function in the package. https://github.com/stephenturner/rpdd/blob/main/R/utils.R

I do have a personal R-universe set up. I wonder if there's a way to make this work here. https://stephenturner.r-universe.dev/rpdd

@pawelru
Copy link
Contributor

pawelru commented Dec 2, 2024

If you already have r-universe then it would help a lot.

Please have a look at my question on how to use custom repos here. It's not super clean but it's working. I hope that it would become much nicer in the future.

This is a fully functional app that uses wasm binaries from your r-universe with the workaround I mentioned:

webr::install("rpdd", repos = c("https://stephenturner.r-universe.dev/"))

library(shiny)

ui <- basicPage(
  verbatimTextOutput("txt")
)
server <- function(input, output) {
  output$txt <- renderText(paste0(capture.output(print(rpdd::missyelliot)), collapse = "\n"))
}

shinyApp(ui = ui, server = server)

URL:
https://shinylive.io/r/editor/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAdzgCMAnRRASwgGdSoAbbgCgA6YBqgAmoobgAEDOKiLspAXikFBYABalSqdogD0+znI0VSAVwYQ4DDAwC05iCwBuN9nAyi4L-UICU-gIQwdwsjFAMAJ587BpsUUEhEOYsUgA89lJ0UOwsBAAKUADmcIIQUlJuDDmkLDAAKnAAHqQA8uY6neqkrQHBSR4M1RlZAGZOBHUkfGyondJEnfOk-lIgwZVLXaQAJL2kozIU3gxNrXyoueQADHwEaBayGNsrlwxspHwi4swwLOx2FE4LwWERVv5pMReGgPMopEIBMEAkkAL7IjjxCBRACC6D4qXhqWkQxGKlJNiSYFRAF0gA

Now it is just the matter of including this in the shinylive-examples code using the concept of decoration. It's is flexible enough to allow you to prepend the workaround code so that it would be fully functional. This should work! Please let me know if that helps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants