Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Solymos <psolymos@gmail.com>
  • Loading branch information
psolymos committed Jul 6, 2024
1 parent 84cc45b commit 5d80ec0
Showing 1 changed file with 61 additions and 119 deletions.
180 changes: 61 additions & 119 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,176 +5,118 @@ Shiny app displaying the histogram of the Old Faithful geyser waiting times.
- [Hello Shiny App](#hello-shiny-app)
- [R](#r)
- [Python](#python)
- [Shinylive with R \& Python](#shinylive-with-r--python)
- [Rmarkdown](#rmarkdown)
- [Quarto with R](#quarto-with-r)
- [Quarto with Python](#quarto-with-python)
- [Quarto with Shinylive (Python)](#quarto-with-shinylive-python)
- [Quarto with Shinylive (R)](#quarto-with-shinylive-r)
- [R package](#r-package)
- [Rhino](#rhino)
- [Golem](#golem)
- [Leprechaun](#leprechaun)
- [Shiny in an R package](#shiny-in-an-r-package)
- [R package without a framework](#r-package-without-a-framework)
- [Golem](#golem)
- [Leprechaun](#leprechaun)
- [R Shiny as a Rhino app](#r-shiny-as-a-rhino-app)
- [Shinylive](#shinylive)
- [Python Shinylive](#python-shinylive)
- [R Shinylive](#r-shinylive)
- [R Markdown](#r-markdown)
- [R Markdown with runtime `shiny`](#r-markdown-with-runtime-shiny)
- [Prerendered R Markdown with runtime `shinyrmd`](#prerendered-r-markdown-with-runtime-shinyrmd)
- [Quarto](#quarto)
- [Quarto with R](#quarto-with-r)
- [Quarto with Python](#quarto-with-python)
- [Quarto with Shinylive (Python)](#quarto-with-shinylive-python)
- [Quarto with Shinylive (R)](#quarto-with-shinylive-r)
- [Serving Shinylive on GitHub Pages](#serving-shinylive-on-github-pages)

After running the commands, visit `http://127.0.0.1:8080`. Cancel with Ctrl+C.

## R

```bash
# change directory
cd r-shiny

# install dependencies
R -q -e 'install.packages("deps");deps::install(ask=FALSE)'

# run the app, listen on port 8080
R -q -e 'shiny::runApp(port=8080)'
```
See the [`r-shiny`](./r-shiny/) folder.

## Python

```bash
# change directory
cd py-shiny
See the [`py-shiny`](./py-shiny/) folder.

# install dependencies
pip install -r requirements.txt
## Shiny in an R package

# run the app, listen on port 8080
shiny run --reload --port 8080
```
### R package without a framework

## Shinylive with R & Python
See the [`r-package`](./r-package/) folder.

Create Python shinylive version following <https://github.com/posit-dev/py-shinylive>:
### Golem

```bash
shinylive export py-shiny py-shinylive
python3 -m http.server --directory py-shinylive 8080
```
See the [`r-golem`](./r-golem/) folder.

Create R shinylive version following <https://posit-dev.github.io/r-shinylive/>:
### Leprechaun

```bash
R -q -e 'shinylive::export("r-shiny", "r-shinylive")'
R -q -e 'httpuv::runStaticServer("r-shinylive", port=8080)'
```
See the [`r-leprechaun`](./r-leprechaun/) folder.

## Rmarkdown
## R Shiny as a Rhino app

Runtime `shiny`
See the [`r-rhino`](./r-rhino/) folder.

```bash
cd rmd-shiny
R -q -e 'rmarkdown::run(shiny_args = list(port = 8080))'
```

Runtime `shinyrmd` (`shiny_prerendered`)

```bash
cd rmd-prerendered
# prerender
R -e "rmarkdown::render('index.Rmd')"
# serve
RMARKDOWN_RUN_PRERENDER=0 R -q -e 'rmarkdown::run(shiny_args = list(port = 8080))'
# or
R -q -e 'Sys.setenv(RMARKDOWN_RUN_PRERENDER=0);rmarkdown::run(shiny_args = list(port = 8080))'
```
## Shinylive

## Quarto with R
### Python Shinylive

Server `shiny`
Create Python Shinylive version following <https://github.com/posit-dev/py-shinylive>:

```bash
cd quarto-r-shiny
quarto serve index.qmd --port 8080
```
# Export static files
shinylive export py-shiny/app py-shinylive

Server `shiny`, prerendered.

```bash
quarto render index.qmd
quarto serve index.qmd --port 8080 --no-render
# Serve contents, visit http://localhost:8080
python3 -m http.server --directory py-shinylive 8080
```

## Quarto with Python
### R Shinylive

Server `shiny`
Create R Shinylive version following <https://github.com/posit-dev/r-shinylive/>:

```bash
cd quarto-py-shiny
quarto serve index.qmd --port 8080
```

Server `shiny`, prerendered.
# Export static files
R -q -e "shinylive::export('r-shiny/app', 'r-shinylive')"

```bash
quarto render index.qmd
quarto serve index.qmd --port 8080 --no-render
# Serve contents, visit http://localhost:8080
R -q -e "httpuv::runStaticServer('r-shinylive', port=8080)"
```

## Quarto with Shinylive (Python)
## R Markdown

Need to add an extension: `quarto add quarto-ext/shinylive`.
### R Markdown with runtime `shiny`

```bash
quarto preview index.qmd --port 8080 --no-watch-inputs --no-browser
```
See the [`rmd-shiny`](./rmd-shiny/) folder.

## Quarto with Shinylive (R)
### Prerendered R Markdown with runtime `shinyrmd`

Need to add an extension: `quarto add quarto-ext/shinylive`.
See the [`rmd-prerendered`](./rmd-prerendered/) folder.

```bash
quarto preview index.qmd --port 8080 --no-watch-inputs --no-browser
```
## Quarto

## R package
### Quarto with R

```bash
cd r-package
See the [`quarto-r-shiny`](./quarto-r-shiny/) folder for a single file,
and [`quarto-r-shiny-multifile`](./quarto-r-shiny-multifile/) folder
for multiple-file based versions.

R -q -e 'roxygen2::roxygenise("faithful")'
R CMD build faithful
R CMD check faithful_0.0.1.tar.gz
R CMD install faithful_0.0.1.tar.gz
### Quarto with Python

R -q -e 'faithful::run_app(port=8080)'
```
See the [`quarto-py-shiny`](./quarto-py-shiny/) folder.

## Rhino
### Quarto with Shinylive (Python)

```bash
R -q -e 'shiny::runApp("r-rhino", port=8080)'
```
Need to add an extension: `quarto add quarto-ext/shinylive`.

## Golem
FIXME: add how to render here

```bash
cd r-golem

R -q -e 'roxygen2::roxygenise("faithfulGolem")'

R CMD build faithfulGolem
R CMD check faithfulGolem_0.0.1.tar.gz
R CMD install faithfulGolem_0.0.1.tar.gz

R -q -e 'faithfulGolem::run_app(options=list(port=8080))'
quarto preview index.qmd --port 8080 --no-watch-inputs --no-browser
```

## Leprechaun
### Quarto with Shinylive (R)

```bash
cd r-leprechaun

R -q -e 'roxygen2::roxygenise("faithfulLeprechaun")'
Need to add an extension: `quarto add quarto-ext/shinylive`.

R CMD build faithfulLeprechaun
R CMD check faithfulLeprechaun_0.0.1.tar.gz
R CMD install faithfulLeprechaun_0.0.1.tar.gz
FIXME: add how to render here

R -q -e 'faithfulLeprechaun::run(options=list(port=8080))'
```bash
quarto preview index.qmd --port 8080 --no-watch-inputs --no-browser
```

## Serving Shinylive on GitHub Pages
Expand Down

0 comments on commit 5d80ec0

Please sign in to comment.