Skip to contents

This function generates a pipeline.nix file based on a list of derivation objects. Each derivation defines a build step, and rixpress() chains these steps and handles the serialization and conversion of Python objects into R objects (or vice-versa). Derivations are created with rxp_r(), rxp_py() and so on. By default, the pipeline is also immedtiately after being generated, but the build process can be postponed by setting build to FALSE. In this case, the pipeline can then be built using rxp_make().

Usage

rixpress(derivs, project_path, build = TRUE, ...)

Arguments

derivs

A list of derivation objects, where each object is a list of five elements: - $name, character, name of the derivation - $snippet, character, the nix code snippet to build this derivation - $type, character, can be R, Python or Quarto - $additional_files, character vector of paths to files to make available to build sandbox - $nix_env, character, path to Nix environment to build this derivation A single deriv is the output of rxp_r(), rxp_quarto() or rxp_py() function.

project_path

Path to root of project, typically "."

build

Logical, defaults to TRUE. Should the pipeline get built right after being generated? If FALSE, you can build the pipeline later using rixpress()

...

Further arguments passed down to methods. Use max-jobs and cores to set parallelism during build. See the documentation of rxp_make() for more details.

Value

A character string containing the complete Nix code for a pipeline.nix file. This string can be written to a file or passed to another function for further processing.

Details

The generated pipeline.nix expression includes:

  • the required imports of environments, typically default.nix files generated by the rix package;

  • correct handling of interdependencies of the different derivations;

  • serialization and deserialization of both R and Python objects, and conversion between them when objects are passed from one language to another;

  • correct loading of R and Python packages, or extra functions needed to build specific targets

In some cases, due to the automatic handling of Python packages, users might want to change import statements. By default if, say, pandas is needed to build a derivation, it will be imported with import pandas. However, Python programmers typically use import pandas as pd. To change the automatic import statements, please refer to adjust_imports().

Examples

if (FALSE) { # \dontrun{
# Create derivation objects
d1 <- rxp_r(mtcars_am, filter(mtcars, am == 1))
d2 <- rxp_r(mtcars_head, head(mtcars_am))
list_derivs <- list(d1, d2)

# Generate the pipeline code
rixpress(derivs = list_derivs, project_path = ".", build = TRUE)

} # }