rattlerthis rattlerthis repository

rattlerthis is the "rattler" backend of condathis. It solves, installs and activates 'Conda' environments inside the R process, through the Rust library rattler (the engine behind pixi), bound to R with rextendr. There is no package manager binary to download.

rattlerthis exports no functions. Everything a user does goes through condathis with method = "rattler": the arguments, checks, messages, results and error classes are those of condathis.

Installation

Building from source needs a Rust toolchain, rustc >= 1.88.0 and cargo (https://rustup.rs), plus:

# install.packages("pak")
# pak::pak("luciorq/rattlerthis")
install.packages("rattlerthis", repos = c('https://luciorq.r-universe.dev', 'https://cloud.r-project.org'))

This also installs the condathis version that rattlerthis needs. The build downloads the Rust crates it needs from crates.io and GitHub.

WebAssembly (webR) is not supported: rattler cannot be built for it, and webR cannot run the commands of an environment. There, rattlerthis installs without its Rust library, and method = "rattler" fails with an error of class rattlerthis_rust_unavailable (also condathis_backend_unsupported) that says so.

Usage

library(condathis)

create_env("ripgrep", env_name = "rg", method = "rattler")
run("rg", "--version", env_name = "rg")
list_envs(method = "rattler")
remove_env("rg", method = "rattler")

condathis loads rattlerthis when method = "rattler" is used, and when rattler environments exist, so method = "auto" finds them without loading anything by hand.

The environments and rattler's caches live in condathis::backend_root_dir("rattler"), the rattler directory inside condathis's data directory. condathis::with_sandbox_dir() moves it with the rest of condathis's directories, and condathis::clean_cache() cleans rattler's caches too.

rattlerthis has no options and no environment variables of its own. condathis's settings apply, and the generic Conda variables CONDA_OVERRIDE_* are honored, as micromamba honors them.

Differences from the micromamba backend

Both backends behave the same wherever possible: commands run in the same activated environment (also one given by env_path()), activations are cached, pip sections of environment files are installed and listed alike, and condathis lets one R session at a time change an environment. The main differences:

?rattlerthis lists the differences a user may notice.

Development

The test suite runs with NOT_CRAN=true and must end with 0 failures, 0 errors and exactly 2 skips: the two wheel tests, which skip because the wheels Cargo feature is off by default. The parity tests compare both backends with the micromamba binary named by CONDATHIS_MICROMAMBA_PATH; some download from conda-forge. CI (.github/workflows/) runs the check and that test step on Linux, macOS, Windows x64 and Windows on ARM64.

The vendored Rust crates, src/rust/vendor.tar.xz (written by just update-vendor), are not in git. A build without them downloads the crates from crates.io, as CI and r-universe do; with them, the build is offline. The tarball is made only before a CRAN submission and for major releases, and each one is to be archived on Zenodo. PLAN.md ("Releasing the vendored tarball") has the policy and the checksum tooling it still needs.