MyNixOS website logo
Description
A Friendly Package Manager
Manage project dependencies from your DESCRIPTION file. Create a reproducible virtual environment with minimal additional files in your project. Provides tools to add, remove, and update dependencies as well as install existing dependencies with a single function.

Jetpack

:fire: A friendly package manager for R

  • Lightweight - adds just three files to your project
  • Designed for reproducibility - thanks to renv, no more global installs!
  • Works from both R and the command line

Inspired by Yarn, Bundler, and Pipenv

Build Status CRAN status

Installation

Install Jetpack

install.packages("jetpack")

How It Works

Jetpack uses the DESCRIPTION file to store your project dependencies. It stores the specific version of each package in renv.lock. This makes it possible to have a reproducible environment. You can edit dependencies in the DESCRIPTION file directly, but Jetpack provides functions to help with this.

Getting Started

Open a project and run:

jetpack::init()

Commands

Install

Install packages for a project

jetpack::install()

This ensures all the right versions are installed locally. As dependencies change, collaborators should run this command to stay synced.

Be sure to prefix commands with jetpack::. Jetpack isn’t installed in your virtual environment, so library(jetpack) won’t work.

Add

Add a package

jetpack::add("randomForest")

Add multiple packages

jetpack::add(c("randomForest", "DBI"))

Add a specific version

jetpack::add("[email protected]")

Add from GitHub or another remote source

jetpack::add("plyr", remote="hadley/plyr")

Supports these remotes

Add from a specific tag, branch, or commit

jetpack::add("plyr", remote="hadley/[email protected]")

Add from a local source

jetpack::add("plyr", remote="local::/path/to/plyr")

The local directory must have the same name as the package

Update

Update a package

jetpack::update("randomForest")

For local packages, run this anytime the package code is changed

Update multiple packages

jetpack::update(c("randomForest", "DBI"))

Update all packages

jetpack::update()

Remove

Remove a package

jetpack::remove("randomForest")

Remove multiple packages

jetpack::remove(c("randomForest", "DBI"))

Remove remotes as well

jetpack::remove("plyr", remote="hadley/plyr")

Check

Check that all dependencies are installed

jetpack::check()

Outdated

Show outdated packages

jetpack::outdated()

Source Control

Be sure to commit the files Jetpack generates to source control.

Bioconductor

For Bioconductor, add the BiocManager package first:

jetpack::add("BiocManager")

Then add other packages:

jetpack::add("Biobase", remote="bioc::release/Biobase")

Deployment

Server

Install Jetpack on the server and run:

jetpack::install(deployment=TRUE)

Docker

Create init.R with:

install.packages("jetpack")
jetpack::install(deployment=TRUE)

And add it into your Dockerfile:

FROM r-base

RUN apt-get update && apt-get install -qq -y --no-install-recommends \
  libxml2-dev libssl-dev libcurl4-openssl-dev libssh2-1-dev

RUN mkdir -p /app
WORKDIR /app

COPY init.R DESCRIPTION renv.lock ./
RUN Rscript init.R

COPY . .

CMD Rscript app.R

Heroku

For the R buildpack, create init.R with:

install.packages("jetpack")
jetpack::install(deployment=TRUE)

Alternatively, you can use Docker Deploys on Heroku.

Command Line

Jetpack can also be run from the command line. To install the CLI, run:

jetpack::cli()

On Windows, add C:\ProgramData\jetpack\bin to your PATH. See instructions for how to do this.

All the Jetpack commands are now available

jetpack init
jetpack install
jetpack add randomForest
jetpack add [email protected]
jetpack add plyr --remote=hadley/plyr
jetpack update randomForest
jetpack remove DBI
jetpack check
jetpack outdated

You can also use it to manage global packages

jetpack global add randomForest
jetpack global update DBI
jetpack global update
jetpack global remove plyr
jetpack global list
jetpack global outdated

You can even use it to update itself

jetpack global update jetpack

For the full list of commands, use:

jetpack help

Upgrading

To upgrade, rerun the installation instructions.

0.5.0

Jetpack 0.5.0 uses renv instead of Packrat. To upgrade a project:

  1. Run jetpack::migrate()
  2. Delete packrat.lock
  3. Run jetpack::install()

0.4.0

Jetpack 0.4.0 greatly reduces the number of dependencies. As part of this, the info and search commands have been removed.

0.3.0

Jetpack 0.3.0 greatly reduces the number of files in your projects. To upgrade a project:

  1. Move packrat/packrat.lock to packrat.lock
  2. Delete the packrat directory
  3. Delete .Rbuildignore and .gitignore if they only contain Packrat references
  4. Replace all Jetpack and Packrat code in your .Rprofile with:
if (requireNamespace("jetpack", quietly=TRUE)) {
  jetpack::load()
} else {
  message("Install Jetpack to use a virtual environment for this project")
}
  1. Open R and run:
jetpack::install()

History

View the changelog

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help:

To get started with development and testing:

git clone https://github.com/ankane/jetpack.git
cd jetpack

In R, do:

install.packages("devtools")
devtools::install_deps(dependencies=TRUE)
devtools::test()

To test a single file, use:

devtools::install() # to use latest updates
devtools::test_active_file("tests/testthat/test-jetpack.R")
Metadata

Version

0.5.5

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows