Skip to main content

Generate R helper scripts for use on Domino Data Lab

Project description

rgear - Generate R helper files

The aim of rgear is to provide simple tooling to create helper files for R based content.

The files it creates allow you to serve R based content (Shiny apps, plumber APIs or RMarkdown html outputs) from the command line.

Originally created for use with Domino Data Lab, rgear can be used wherever R is and therefore also makes a great complement to other projects such as (R4Pi)[https://r4pi.org].

Supported content types:

  • Shiny apps
  • Rmarkdown html output
  • Plumber APIs

Installation

rgear is written in Python, and can be installed directly from PyPI:

# python3 -m pip install rgear

Usage

rgear --help
usage: rgear [-h] [-f] [-p PORT] [-v] [--version]
             {shiny,plumber,rmarkdown} path

Generates helper scripts for starting R based content servers

positional arguments:
  {shiny,plumber,rmarkdown}
                        choose the application type you want to serve
  path                  path to the content to serve

optional arguments:
  -h, --help            show this help message and exit
  -f, --force           force overwrite if the output file(s) already exist
  -p PORT, --port PORT  override the default port setting. [default: 8888]
  -v, --verbose         enable verbose output
  --version             print the version and exit

For detailed help, please see https://github.com/sellorm/rgear

Using the above options, various files -- mostly app.sh -- will be written to the working directory with the required parameters already populated.

The app.sh file created by rgear can be used to start the specified content from the command line. This makes it an ideal complement to all command-line uses of R.

For example, to generate a script to serve a plumber API:

# rgear plumber plumber.R

Using with Domino Data Lab

Domino Data Lab can then use these files to serve your content as a DDL "(app)[https://docs.dominodatalab.com/en/latest/user_guide/71635d/publish-apps/]".

The "app.sh" files created by rgear have sensible defaults for Domino and allows users to generate the file(s) they need without too much effort.

Use rgear to generate the "app.sh" file you need for your specific content type and then configure Domino to use that file to serve your content.

Using with command line R (Including R4Pi)

Use rgear to generate startup scripts for your Shiny apps, plumber APIs or RMarkdown reports.

For example, if you have a Shiny app in an "app.R" file, run:

# rgear shiny app.R

Then you can run the app with:

# ./app.sh

Then visit the app in your browser using either http://localhost:8888 or http://:8888.

Use ctrl+c to stop the app from running.

You can run the "app.sh" script in the background with:

# nohup ./app.sh &

You'll need to use ps and kill to stop an application started this way.

License

MIT License Copyright (c) 2023 Mark Sellors

See the LICENSE file for the full text of the license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rgear-0.2.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

rgear-0.2.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file rgear-0.2.0.tar.gz.

File metadata

  • Download URL: rgear-0.2.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.9.2 Linux/5.15.84-v7l+

File hashes

Hashes for rgear-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f2ef4268a076340e8b682ceaa985643f12617e44f83ce16459e374a4ed00e1b4
MD5 a3188ebefc3df1fd692454011ae3f83c
BLAKE2b-256 0c524479dd6d05b0b3923d40cc68917df9fdbc2bd1d3783695db4e612fc4eb20

See more details on using hashes here.

File details

Details for the file rgear-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: rgear-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.9.2 Linux/5.15.84-v7l+

File hashes

Hashes for rgear-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0ff35f84ec964f019a8becf6ec43bf031cb5dd487c13499df91dfea0c9cdc9ae
MD5 a91f4bda8e03341310c9afa79d7500be
BLAKE2b-256 e51a6bcbb5d3da12c38bd317e437f956ecc903622944fcbefd38a6a594193500

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page