Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.0%) to scientific vocabulary

Keywords from Contributors

shiny htmlwidgets pandoc interactive leaflet-map datatables
Last synced: 10 months ago · JSON representation

Repository

Basic Info
Statistics
  • Stars: 207
  • Watchers: 14
  • Forks: 19
  • Open Issues: 47
  • Releases: 4
Created almost 3 years ago · Last pushed 11 months ago
Metadata Files
Readme Changelog License

README.md

shinylive

R-CMD-check CRAN status <!-- badges: end -->

The goal of the {shinylive} R package is to help you create Shinylive applications from your Shiny for R applications. Shinylive is a new way to run Shiny entirely in the browser, without any need for a hosted server, using WebAssembly via the webR project.

About Shinylive

The Shinylive project consists of four interdependent components that work together in several different contexts.

  1. Shinylive (posit-dev/shinylive) is web assets library that runs Shiny applications in the browser. You can try it out online at shinylive.io/r or shinylive.io/py. For a more in-depth exploration of the Shinylive web assets, please check out https://www.tidyverse.org/blog/2024/10/shinylive-0-8-0/.

  2. The {shinylive} R package (posit-dev/r-shinylive) helps you export your Shiny applications from local files to a directory that can be hosted on a static web server.

The R package also downloads the Shinylive web assets mentioned above and manages them in a local cache. These assets are included in the exported Shinylive applications and are used to run your Shiny app in the browser.

  1. The shinylive Python package (posit-dev/py-shinylive) serves the same role as {shinylive} but for Shiny for Python applications.

  2. The shinylive Quarto extension (quarto-ext/shinylive) lets you write Shiny applications in Quarto web documents and slides and uses the R or Python package (or both) to translate shinylive-r or shinylive-py code blocks into Shinylive applications.

Installation

You can install the released version of shinylive from CRAN via:

r install.packages("shinylive")

You can install the development version of shinylive from GitHub via:

``` r

install.packages("pak")

pak::pak("posit-dev/r-shinylive") ```

Usage

To get started, we'll create a basic shiny application in a new directory myapp/. If you have an existing Shiny application, you can skip this step and replace "myapp" with the path to your existing app.

``` r

Copy "Hello World" from {shiny}

system.file("examples", "01hello", package="shiny") |> fs::dircopy("myapp", overwrite = TRUE) ```

Once you have a Shiny application in myapp/ and would like turn it into a Shinylive app in site/:

r shinylive::export("myapp", "site")

Then you can preview the application by running a web server and visiting it in a browser:

r httpuv::runStaticServer("site/")

At this point, you can deploy the site/ directory to any static web hosting service.

Multiple applications

If you have multiple applications that you want to put on the same site, you can export them to subdirectories of the site, so that they can all share the same Shinylive assets. You can do this with the --subdir option:

r shinylive::export("myapp1", "site", subdir = "app1") shinylive::export("myapp2", "site", subdir = "app2")

GitHub Pages

posit-dev/r-shiny has a workflow to automatically deploy your Shiny app from the root directory in your GitHub repository to its GitHub Pages. You can add this workflow to your repo with help from usethis.

r usethis::use_github_action(url="https://github.com/posit-dev/r-shinylive/blob/actions-v1/examples/deploy-app.yaml")

For more information, see the examples folder.

R package availability

The {shinylive} web assets will statically inspect which packages are being used in your app.

If your app includes a package that is not automatically discovered, you can add an impossible-to-reach code within your Shiny application that has a library call to that R package. For example:

r if (FALSE) { library(HIDDEN_CRAN_PKG) }

If you'd rather handle it manually, call webr::install("CRAN_PKG") in your Shiny application before calling library(CRAN_PKG) or require("CRAN_PKG").

If an R package has trouble loading, visit https://repo.r-wasm.org/ to see if it is able to be installed as a precompiled WebAssembly binary.

Note from {webr}:
It is not possible to install packages from source in webR. This is not likely to change in the near future, as such a process would require an entire C and Fortran compiler toolchain to run inside the browser. For the moment, providing pre-compiled WebAssembly binaries is the only supported way to install R packages in webR.

Shinylive asset management

Each version of the Shinylive R package is associated with a particular version of the Shinylive web assets. (See the releases here.)

To see which version of this R package you have, and which version of the web assets it is associated with, simply run shinylive::assets_info() in your R session. It will also show which asset versions you have already installed locally:

``` r shinylive::assets_info()

> shinylive R package version: 0.1.0

> shinylive web assets version: 0.2.1

>

> Local cached shinylive asset dir:

> /Users/username/Library/Caches/shinylive

>

> Installed assets:

> /Users/username/Library/Caches/shinylive/0.2.1

> /Users/username/Library/Caches/shinylive/0.2.0

```

The web assets will be downloaded and cached the first time you run shinylive::export(). Or, you can run shinylive::assets_download() to fetch them manually.

``` r shinylive::assets_download("0.1.5")

> Downloading shinylive v0.1.5...

> Unzipping to /Users/username/Library/Caches/shinylive/

```

You can remove old versions with shinylive::assets_cleanup(). This will remove all versions except the one that the Python package wants to use:

``` r shinylive::assets_cleanup()

> Keeping version 0.2.1

> Removing /Users/username/Library/Caches/shinylive/0.2.0

> Removing /Users/username/Library/Caches/shinylive/0.1.5

```

To remove a specific version, use shinylive::assets_remove():

``` r shinylive::assets_remove("0.2.1")

> Removing /Users/username/Library/Caches/shinylive/0.2.1

```

Known limitations

  • Note from {webr}:
    • > It is not possible to install packages from source in webR. This is not likely to change in the near future, as such a process would require an entire C and Fortran compiler toolchain to run inside the browser. For the moment, providing pre-compiled WebAssembly binaries is the only supported way to install R packages in webR.

Development

Setup - shinylive assets

Works with latest GitHub version of posit-dev/shinylive (>= v0.2.1).

Before linking the shinylive assets to the asset cache folder, you must first build the shiny live assets:

```bash

In your shinylive assets repo

cd PATH/TO/posit-dev/shinylive

Generate the shiny live assets

make submodules all ```

Then link the assets (using the {shinylive} R package) to the asset cache folder so that changes to the assets are automatically in your cached shinylive assets:

```r

Link to your local shinylive repo

shinylive::assetsinstalllink("PATH/TO/posit-dev/shinylive") ```

Setup - quarto

In your quarto project, call the following lines in the terminal to install the updated shinylive quarto extension:

```bash

Go to the quarto project directory

cd local/quarto

Install the updated shinylive quarto extension

quarto add quarto-ext/shinylive ```

By default, the extension will used the installed {shinylive} R package. To use the local {shinylive} R package, run the following in your R session to update the quarto extension locally:

```R if (!require("pkgload")) install.packages("pkgload")

shinylivelua <- file.path("local", "quarto", "extensions", "quarto-ext", "shinylive", "shinylive.lua") shinylivelua |> brio::readfile() |> sub( pattern = "shinylive::quartoext()", replacement = "pkgload::loadall('../../', quiet = TRUE); shinylive::quartoext()", fixed = TRUE ) |> brio::writefile(shinylive_lua) ```

Execute - export()

Export a local app to a directory and run it:

```r library(httpuv) # >= 1.6.12 pkgload::load_all()

Delete prior

unlink("local/shiny-apps-out/", recursive = TRUE) export("local/shiny-apps/simple-r", "local/shiny-apps-out")

Host the local directory

httpuv::runStaticServer("local/shiny-apps-out/") ```

Owner

  • Name: posit-dev
  • Login: posit-dev
  • Kind: organization

GitHub Events

Total
  • Create event: 6
  • Release event: 1
  • Issues event: 28
  • Watch event: 50
  • Delete event: 5
  • Issue comment event: 58
  • Push event: 22
  • Pull request review event: 3
  • Pull request event: 9
  • Fork event: 1
Last Year
  • Create event: 6
  • Release event: 1
  • Issues event: 28
  • Watch event: 50
  • Delete event: 5
  • Issue comment event: 58
  • Push event: 22
  • Pull request review event: 3
  • Pull request event: 9
  • Fork event: 1

Committers

Last synced: about 1 year ago

All Time
  • Total Commits: 96
  • Total Committers: 8
  • Avg Commits per committer: 12.0
  • Development Distribution Score (DDS): 0.427
Past Year
  • Commits: 36
  • Committers: 3
  • Avg Commits per committer: 12.0
  • Development Distribution Score (DDS): 0.5
Top Committers
Name Email Commits
Barret Schloerke b****t@p****o 55
Garrick Aden-Buie g****k@a****m 18
George Stagg g****g@p****o 18
timelyportfolio k****l@t****m 1
stla l****p@y****r 1
Winston Chang w****n@s****g 1
Eric Nantz t****t@g****m 1
Doug Kelkhoff 1****f 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 87
  • Total pull requests: 63
  • Average time to close issues: about 2 months
  • Average time to close pull requests: 3 days
  • Total issue authors: 61
  • Total pull request authors: 5
  • Average comments per issue: 1.78
  • Average comments per pull request: 0.54
  • Merged pull requests: 56
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 26
  • Pull requests: 11
  • Average time to close issues: 17 days
  • Average time to close pull requests: 9 days
  • Issue authors: 24
  • Pull request authors: 2
  • Average comments per issue: 0.77
  • Average comments per pull request: 1.09
  • Merged pull requests: 10
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • daattali (6)
  • gadenbuie (4)
  • georgestagg (4)
  • seanbirchall (3)
  • schloerke (3)
  • willgearty (3)
  • quincountychsmn (3)
  • Luke-Symes-Tsy (2)
  • coatless (2)
  • maek-ies (2)
  • wch (2)
  • dmresearch15 (2)
  • pawelru (2)
  • JoaoGarcezAurelio (2)
  • joscani (1)
Pull Request Authors
  • gadenbuie (28)
  • georgestagg (18)
  • schloerke (13)
  • parmsam (2)
  • wch (2)
Top Labels
Issue Labels
enhancement (2) wontfix (1) bug (1) question (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 920 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 4
  • Total maintainers: 1
cran.r-project.org: shinylive

Run 'shiny' Applications in the Browser

  • Versions: 4
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 920 Last month
Rankings
Dependent packages count: 27.8%
Dependent repos count: 36.9%
Average: 50.3%
Downloads: 86.1%
Maintainers (1)
Last synced: 11 months ago