Repository navigation
Expand file tree
/
Copy pathrixpress.ctx.yaml
More file actions
486 lines (486 loc) · 31.5 KB
/
Copy pathrixpress.ctx.yaml
File metadata and controls
486 lines (486 loc) · 31.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
---
kind: context_header
llm_instructions: This is an LLM-optimized API specification for the R package 'rixpress'. Use this context to write correct code using rixpress functions. Each 'function' record describes a public function with its signature, arguments, and purpose. The 'package' record contains metadata. All listed functions are part of the public API.
---
kind: package
schema_version: '1.1'
name: rixpress
version: 0.12.3
language: R
description: Build Reproducible Analytical Pipelines with 'Nix'
---
kind: function
name: rxp_make
exported: true
signature: rxp_make(verbose = 0L, max_jobs = 1, cores = 1)
arguments:
cores: Integer, number of cores a derivation can use during build.
max_jobs: Integer, number of derivations to be built in parallel.
verbose: 'Integer, defaults to 0L. Verbosity level: 0 = show progress indicators only, 1+ = show nix output with increasing verbosity. 0: "Progress only", 1: "Informational", 2: "Talkative", 3: "Chatty", 4: "Debug", 5: "Vomit". Values higher than 5 are capped to 5. Each level adds one --verbose flag to nix-store command.'
returns: A character vector of paths to the built outputs.
examples:
- code: rxp_make()
- code: rxp_make(verbose = 2, max_jobs = 4, cores = 2)
- code: rxp_make(verbose = 3)
---
kind: function
name: rxp_export_artifacts
exported: true
signature: rxp_export_artifacts(archive_file = "_rixpress/pipeline_outputs.nar",which_log = NULL,project_path = ".")
arguments:
archive_file: Character, path to the archive, defaults to "_rixpress/pipeline-outputs.nar"
project_path: Character, defaults to ".". Path to the root directory of the project.
which_log: Character or NULL, regex pattern to match a specific log file. If NULL (default), the most recent log file will be used.
returns: Nothing, creates an archive file at the specified location.
examples:
- code: rxp_export_artifacts()
- code: |-
rxp_export_artifacts(
archive_file = "my_archive.nar",
which_log = "20250510"
)
---
kind: function
name: rxp_import_artifacts
exported: true
signature: rxp_import_artifacts(archive_file = "_rixpress/pipeline_outputs.nar")
arguments:
archive_file: Character, path to the archive, defaults to "_rixpress/pipeline-outputs.nar"
returns: Nothing, imports the archive contents into the local Nix store.
examples:
- code: rxp_import_artifacts()
- code: rxp_import_artifacts("path/to/my_archive.nar")
---
kind: function
name: rxp_r_file
exported: true
signature: rxp_r_file(...) rxp_file("R", ...)
arguments:
'...': 'Arguments passed on to \link[=rxp_file]{rxp_file} Symbol, the name of the derivation. Character, the file path to include (e.g., "data/mtcars.shp") or a folder path (e.g., "data"). See details. Function, an R function to read the data, taking one argument (the path). This can be a user-defined function that is made available using user_functions. See details. Character vector, user-defined functions to include. This should be a script (or scripts) containing user-defined functions to include during the build process for this derivation. It is recommended to use one script per function, and only include the required script(s) in the derivation. Character, path to the Nix environment file, default is "default.nix". List, defaults to NULL. A named list of environment variables to set before running the R script, e.g., c(VAR = "hello"). Each entry will be added as an export statement in the build phase. Function/character, defaults to NULL. A language-specific serializer to write the loaded object to disk. R: function/symbol/character (e.g., qs::qsave) taking (object, path). Defaults to saveRDS. Python: character name of a function taking (object, path). Defaults to using pickle.dump. Julia: character name of a function taking (object, path). Defaults to using Serialization.serialize.'
returns: An object of class rxp_derivation.
---
kind: function
name: rxp_py_file
exported: true
signature: rxp_py_file(...) rxp_file("Py", ...)
arguments:
'...': 'Arguments passed on to \link[=rxp_file]{rxp_file} Symbol, the name of the derivation. Character, the file path to include (e.g., "data/mtcars.shp") or a folder path (e.g., "data"). See details. Function, an R function to read the data, taking one argument (the path). This can be a user-defined function that is made available using user_functions. See details. Character vector, user-defined functions to include. This should be a script (or scripts) containing user-defined functions to include during the build process for this derivation. It is recommended to use one script per function, and only include the required script(s) in the derivation. Character, path to the Nix environment file, default is "default.nix". List, defaults to NULL. A named list of environment variables to set before running the R script, e.g., c(VAR = "hello"). Each entry will be added as an export statement in the build phase. Function/character, defaults to NULL. A language-specific serializer to write the loaded object to disk. R: function/symbol/character (e.g., qs::qsave) taking (object, path). Defaults to saveRDS. Python: character name of a function taking (object, path). Defaults to using pickle.dump. Julia: character name of a function taking (object, path). Defaults to using Serialization.serialize.'
returns: An object of class rxp_derivation.
---
kind: function
name: rxp_jl_file
exported: true
signature: rxp_jl_file(...) rxp_file("Jl", ...)
arguments:
'...': 'Arguments passed on to \link[=rxp_file]{rxp_file} Symbol, the name of the derivation. Character, the file path to include (e.g., "data/mtcars.shp") or a folder path (e.g., "data"). See details. Function, an R function to read the data, taking one argument (the path). This can be a user-defined function that is made available using user_functions. See details. Character vector, user-defined functions to include. This should be a script (or scripts) containing user-defined functions to include during the build process for this derivation. It is recommended to use one script per function, and only include the required script(s) in the derivation. Character, path to the Nix environment file, default is "default.nix". List, defaults to NULL. A named list of environment variables to set before running the R script, e.g., c(VAR = "hello"). Each entry will be added as an export statement in the build phase. Function/character, defaults to NULL. A language-specific serializer to write the loaded object to disk. R: function/symbol/character (e.g., qs::qsave) taking (object, path). Defaults to saveRDS. Python: character name of a function taking (object, path). Defaults to using pickle.dump. Julia: character name of a function taking (object, path). Defaults to using Serialization.serialize.'
returns: An object of class rxp_derivation.
---
kind: function
name: rxp_py2r
exported: true
signature: rxp_py2r(name, expr, nix_env = "default.nix", project_path = ".")
arguments:
expr: Symbol, Python object to be loaded into R.
name: Symbol, name of the derivation.
nix_env: Character, path to the Nix environment file, default is "default.nix".
project_path: Character, path to the project root, default is ".".
returns: An object of class rxp_derivation.
---
kind: function
name: rxp_r2py
exported: true
signature: rxp_r2py(name, expr, nix_env = "default.nix", project_path = ".")
arguments:
expr: Symbol, R object to be saved into a Python pickle.
name: Symbol, name of the derivation.
nix_env: Character, path to the Nix environment file, default is "default.nix".
project_path: Character, path to the project root, default is ".".
returns: An object of class rxp_derivation.
---
kind: function
name: rxp_init
exported: true
signature: rxp_init(project_path = ".", skip_prompt = FALSE)
arguments:
project_path: Character string specifying the project's path.
skip_prompt: Logical. If TRUE, skips all confirmation prompts and proceeds with initialization, useful on continuous integration. Defaults to FALSE.
returns: Logical. Returns TRUE if initialization was successful, FALSE if the operation was cancelled by the user.
examples:
- code: rxp_init()
---
kind: function
name: rxp_gc
exported: true
signature: rxp_gc(keep_since = NULL,project_path = ".",dry_run = FALSE,timeout_sec = 300,verbose = FALSE,ask = TRUE)
arguments:
ask: Logical. If TRUE, ask for user confirmation before performing deleting artifacts. Default is TRUE.
dry_run: Logical. If TRUE, shows what would be deleted without actually performing any deletions. Useful for previewing the cleanup operation. Default is FALSE.
keep_since: Date or character string (YYYY-MM-DD format). If provided, only build logs older than this date will be targeted for deletion, along with their associated Nix store paths. If NULL, performs a full Nix garbage collection. Default is NULL.
project_path: Character string specifying the path to the project directory containing the _rixpress folder with build logs. Default is "." (current directory).
timeout_sec: Numeric. Timeout in seconds for individual Nix commands. Also used for concurrency lock expiration. Default is 300 seconds.
verbose: Logical. If TRUE, provides detailed output including full paths, command outputs, and diagnostic information about references preventing deletion. Default is FALSE.
returns: 'Invisibly returns a list with cleanup summary information: kept: Vector of build log filenames that were kept deleted: Vector of build log filenames targeted for deletion protected: Number of store paths protected via GC roots (date-based mode) deleted_count: Number of store paths successfully deleted failed_count: Number of store paths that failed to delete referenced_count: Number of store paths skipped due to references log_files_deleted: Number of build log files successfully deleted log_files_failed: Number of build log files that failed to delete dry_run_details: List of detailed information when dry_run = TRUE'
examples:
- code: rxp_gc(keep_since = "2025-08-01", dry_run = TRUE, verbose = TRUE)
- code: rxp_gc(keep_since = "2025-08-01")
- code: rxp_gc()
---
kind: function
name: rxp_ga
exported: true
signature: rxp_ga()
returns: Nothing, copies file to a directory.
examples:
- code: rxp_ga()
---
kind: function
name: rxp_pipeline
exported: true
signature: rxp_pipeline(name, path, color = NULL, ...)
arguments:
'...': Additional arguments (currently unused, reserved for future use).
color: Character, optional. A CSS color name (e.g., "darkorange") or hex code (e.g., "#FF5733") to use for this pipeline's nodes in DAG visualizations. If NULL, a default color will be assigned.
name: Character, the name of the pipeline (e.g., "ETL", "Model").
path: Character path to an R script returning a list of derivations, OR a list of derivation objects created by rxp_r(), rxp_py(), etc.
returns: An object of class rxp_pipeline containing the derivations with pipeline metadata attached.
examples:
- code: pipe_etl <- rxp_pipeline("ETL", "pipelines/01_etl.R", color = "darkorange")
- code: pipe_model <- rxp_pipeline("Model", "pipelines/02_model.R", color = "dodgerblue")
- code: rxp_populate(list(pipe_etl, pipe_model))
---
kind: function
name: rxp_list_logs
exported: true
signature: rxp_list_logs(project_path = ".")
arguments:
project_path: Character, defaults to ".". Path to the root directory of the project.
returns: A data frame with log filenames, modification times, and file sizes.
examples:
- code: logs <- rxp_list_logs()
- code: logs <- rxp_list_logs("path/to/project")
---
kind: function
name: rxp_inspect
exported: true
signature: rxp_inspect(project_path = ".", which_log = NULL)
arguments:
project_path: Character, defaults to ".". Path to the root directory of the project.
which_log: Character, defaults to NULL. If NULL the most recent build log is used. If a string is provided, it's used as a regular expression to match against available log files.
returns: A data frame with derivation names, if their build was successful, their paths in the /nix/store, and their build outputs.
examples:
- code: build_results <- rxp_inspect()
- code: build_results <- rxp_inspect(which_log = "20250510")
- code: failed <- subset(build_results, !build_success)
---
kind: function
name: rxp_check_chronicles
exported: true
signature: rxp_check_chronicles(project_path = ".", which_log = NULL)
arguments:
project_path: Character, defaults to ".". Path to the root directory of the project.
which_log: Character, defaults to NULL. If NULL the most recent build log is used. If a string is provided, it's used as a regular expression to match against available log files.
returns: 'A data frame with columns: derivation, chronicle_state, num_operations, num_failed, failed_functions, messages. Returns NULL invisibly if chronicler is not installed or no chronicle objects are found.'
examples:
- code: rxp_check_chronicles()
- code: rxp_check_chronicles(which_log = "20250131")
---
kind: function
name: rxp_populate
exported: true
signature: rxp_populate(derivs,project_path = ".",build = FALSE,py_imports = NULL,...)
arguments:
'...': 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.
build: Logical, defaults to FALSE. Should the pipeline get built right after being generated? When FALSE, use rxp_make() to build the pipeline at a later stage.
derivs: 'A list of derivation objects, where each object is a list of five elements: name, name of the derivation, snippet, the nix code snippet to build this derivation, type, can be R, Python or Quarto, additional_files, character vector of paths to files to make available to build sandbox, nix_env, path to Nix environment to build this derivation. A single deriv is the output of rxp_r(), rxp_qmd() or rxp_py() function.'
project_path: Path to root of project, defaults to ".".
py_imports: 'Named character vector of Python import rewrites. Names are the base modules that rixpress auto-imports as "import name", and values are the desired import lines. For example: c(numpy = "import numpy as np", xgboost = "from xgboost import XGBClassifier"). Each entry is applied by replacing "import name" with the provided string across generated _rixpress Python library files.'
returns: Nothing, writes a file called pipeline.nix with the Nix code to build the pipeline, as well as folder called _rixpress with required internal files.
examples:
- code: d1 <- rxp_r(mtcars_am, filter(mtcars, am == 1))
- code: d2 <- rxp_r(mtcars_head, head(mtcars_am))
- code: list_derivs <- list(d1, d2)
---
kind: function
name: rxp_read
exported: true
signature: rxp_read(derivation_name, which_log = NULL, project_path = ".")
arguments:
derivation_name: Character, the name of the derivation.
project_path: Character, defaults to ".". Path to the root directory of the project.
which_log: Character, defaults to NULL. If NULL the most recent build log is used. If a string is provided, it's used as a regular expression to match against available log files.
returns: The derivation's output.
examples:
- code: mtcars <- rxp_read("mtcars")
- code: mtcars <- rxp_read("mtcars", which_log = "2025-05-10")
---
kind: function
name: rxp_load
exported: true
signature: rxp_load(derivation_name, which_log = NULL, project_path = ".")
arguments:
derivation_name: Character, the name of the derivation.
project_path: Character, defaults to ".". Path to the root directory of the project.
which_log: Character, defaults to NULL. If NULL the most recent build log is used. If a string is provided, it's used as a regular expression to match against available log files.
returns: Nothing, this function has the side effect of loading objects into the parent frame.
examples:
- code: rxp_load("mtcars")
- code: rxp_load("my_python_model")
- code: rxp_load("mtcars", which_log = "2025-05-10")
---
kind: function
name: rxp_dag_for_ci
exported: true
signature: rxp_dag_for_ci(nodes_and_edges = get_nodes_edges(),output_file = "_rixpress/dag.dot")
arguments:
nodes_and_edges: List, output of get_nodes_edges(). Defaults to calling get_nodes_edges().
output_file: Character, the path where the DOT file should be saved. Defaults to "_rixpress/dag.dot". The directory will be created if it doesn't exist.
returns: Nothing, writes the DOT file to the specified output_file.
examples:
- code: rxp_dag_for_ci()
---
kind: function
name: rxp_ggdag
exported: true
signature: rxp_ggdag(nodes_and_edges = get_nodes_edges(),color_by = c("pipeline", "type"),colour_by = NULL)
purpose: Create a Directed Acyclic Graph (DAG) Representing the Pipeline Using {ggplot2
arguments:
color_by: Character, either "pipeline" (default) or "type". When "pipeline", nodes show type as fill colour and pipeline as border. When "type", nodes are coloured entirely by derivation type (rxp_r, rxp_py, etc.).
colour_by: Character, alias for color_by.
nodes_and_edges: List, output of get_nodes_edges().
returns: A {ggplot2} object.
examples:
- code: |-
rxp_ggdag() # Dual encoding: fill = type, border = pipeline
rxp_ggdag(colour_by = "type") # Color entirely by derivation type
---
kind: function
name: rxp_visnetwork
exported: true
signature: rxp_visnetwork(nodes_and_edges = get_nodes_edges(),color_by = c("pipeline", "type"),colour_by = NULL)
purpose: Create a Directed Acyclic Graph (DAG) Representing the Pipeline Using {visNetwork
arguments:
color_by: Character, either "pipeline" (default) or "type". When "pipeline", nodes show type as fill colour and pipeline as border. When "type", nodes are colored by their derivation type (rxp_r, rxp_py, etc.).
colour_by: Character, alias for color_by.
nodes_and_edges: List, output of get_nodes_edges().
returns: Nothing, this function opens a new tab in your browser with the DAG generated using {visNetwork}.
examples:
- code: rxp_visnetwork()
- code: 'rxp_visnetwork(colour_by = "type") # Color by derivation type instead'
---
kind: function
name: rxp_write_dag
exported: true
signature: rxp_write_dag(rxp_list, output_file = "_rixpress/dag.json")
arguments:
output_file: Path to the output JSON file. Defaults to "_rixpress/dag.json".
rxp_list: A list of derivations.
returns: Nothing, writes a JSON file representing the DAG.
examples:
- code: rxp_write_dag(rxp_list)
---
kind: function
name: rxp_r
exported: true
signature: rxp_r(name,expr,additional_files = "",user_functions = "",nix_env = "default.nix",encoder = NULL,decoder = NULL,env_var = NULL,noop_build = FALSE)
arguments:
additional_files: Character vector, additional files to include during the build process. For example, if a function expects a certain file to be available, this is where you should include it.
decoder: 'Function, character, or named vector/list, defaults to NULL. Can be: A single function/string to decode (unserialize) all upstream objects (e.g., readRDS) A named vector/list where names are upstream dependency names and values are their specific decoding functions (e.g., c(mtcars_tail = "qs::qread", mtcars_head = "read.csv")) By default, readRDS() is used. See vignette("encoding-decoding") for more details.'
encoder: 'Function or character defaults to NULL. A function used to encode (serialize) objects for transfer between derivations. It must accept two arguments: the object to encode (first), and the target file path (second). If your function has a different signature, wrap it to match this interface. By default, saveRDS() is used, but this may yield unexpected results, especially for complex objects like machine learning models. For instance, for {keras} models, use keras::save_model_hdf5() to capture the full model (architecture, weights, training config, optimiser state, etc.). See vignette("encoding-decoding") for more details.'
env_var: Character vector, defaults to NULL. A named vector of environment variables to set before running the R script, e.g., c("CMDSTAN" = "$\{defaultPkgs.cmdstan\}/opt/cmdstan)". Each entry will be added as an export statement in the build phase.
expr: R code to generate the expression. Ideally it should be a call to a pure function, or a piped expression. Multi-line expressions are not supported.
name: Symbol, name of the derivation.
nix_env: Character, path to the Nix environment file, default is "default.nix".
noop_build: Logical, defaults to FALSE. If TRUE, the derivation produces a no-op build (a stub output with no actual build steps). Any downstream derivations depending on a no-op build will themselves also become no-op builds.
user_functions: Character vector, user-defined functions to include. This should be a script (or scripts) containing user-defined functions to include during the build process for this derivation. It is recommended to use one script per function, and only include the required script(s) in the derivation.
returns: An object of class derivation which inherits from lists.
examples:
- code: rxp_r(name = filtered_mtcars, expr = filter(mtcars, am == 1))
- code: |-
rxp_r(
name = turtles,
expr = occurrence(species, geometry = atlantic),
noop_build = TRUE
)
- code: |-
rxp_r(
name = filtered_mtcars,
expr = filter(mtcars, am == 1),
encoder = qs::qsave
)
---
kind: function
name: rxp_py
exported: true
signature: rxp_py(name,expr,additional_files = "",user_functions = "",nix_env = "default.nix",encoder = NULL,decoder = NULL,env_var = NULL,noop_build = FALSE)
arguments:
additional_files: Character vector, additional files to include during the build process. For example, if a function expects a certain file to be available, this is where you should include it.
decoder: 'Character or named vector/list, defaults to NULL. Can be: A single string for the Python function to unserialize all upstream objects A named vector/list where names are upstream dependency names and values are their specific unserialize functions If NULL, the default uses pickle.load. See vignette("encoding-decoding") for more details.'
encoder: 'Character, defaults to NULL. The name of the Python function used to serialize the object. It must accept two arguments: the object to serialize (first), and the target file path (second). If NULL, the default behaviour uses pickle.dump. Define this function in functions.py. See vignette("encoding-decoding") for more details.'
env_var: Character vector, defaults to NULL. A named vector of environment variables before running the Python script, e.g., c(PYTHONPATH = "/path/to/modules"). Each entry will be added as an export statement in the build phase.
expr: Character, Python code to generate the expression. Ideally it should be a call to a pure function. Multi-line expressions are not supported.
name: Symbol, name of the derivation.
nix_env: Character, path to the Nix environment file, default is "default.nix".
noop_build: Logical, defaults to FALSE. If TRUE, the derivation produces a no-op build (a stub output with no actual build steps). Any downstream derivations depending on a no-op build will themselves also become no-op builds.
user_functions: Character vector, user-defined functions to include. This should be a script (or scripts) containing user-defined functions to include during the build process for this derivation. It is recommended to use one script per function, and only include the required script(s) in the derivation.
returns: An object of class derivation which inherits from lists.
examples:
- code: |-
rxp_py(
mtcars_pl_am,
expr = "mtcars_pl.filter(polars.col('am') == 1).to_pandas()"
)
- code: |-
rxp_py(
data_prep,
expr = "preprocess_data(raw_data)",
noop_build = TRUE
)
- code: |-
rxp_py(
mtcars_pl_am,
expr = "mtcars_pl.filter(polars.col('am') == 1).to_pandas()",
user_functions = "functions.py",
encoder = "serialize_model",
additional_files = "some_required_file.bin")
---
kind: function
name: rxp_jl
exported: true
signature: rxp_jl(name,expr,additional_files = "",user_functions = "",nix_env = "default.nix",encoder = NULL,decoder = NULL,env_var = NULL,noop_build = FALSE)
arguments:
additional_files: Character vector, additional files to include during the build process. For example, if a function expects a certain file to be available, this is where you should include it.
decoder: 'Character or named vector/list, defaults to NULL. Can be: A single string for the Julia function to unserialize all upstream objects A named vector/list where names are upstream dependency names and values are their specific unserialize functions If NULL, the default is Serialization.deserialize. See vignette("encoding-decoding") for more details.'
encoder: 'Character, defaults to NULL. The name of the Julia function used to serialize the object. It must accept two arguments: the object to serialize (first), and the target file path (second). If NULL, the default behaviour uses the built‐in Serialization.serialize API. Define any custom serializer in functions.jl. See vignette("encoding-decoding") for more details.'
env_var: Character vector, defaults to NULL. A named vector of environment variables to set before running the Julia script, e.g., c("JULIA_DEPOT_PATH" = "/path/to/depot"). Each entry will be added as an export statement in the build phase.
expr: Character, Julia code to generate the expression. Ideally it should be a call to a pure function. Multi-line expressions are not supported.
name: Symbol, name of the derivation.
nix_env: Character, path to the Nix environment file, default is "default.nix".
noop_build: Logical, defaults to FALSE. If TRUE, the derivation produces a no-op build (a stub output with no actual build steps). Any downstream derivations depending on a no-op build will themselves also become no-op builds.
user_functions: Character vector, user-defined functions to include. This should be a script (or scripts) containing user-defined functions to include during the build process for this derivation. It is recommended to use one script per function, and only include the required script(s) in the derivation.
returns: An object of class derivation which inherits from lists.
examples:
- code: |-
rxp_jl(
name = filtered_df,
expr = "filter(df, :col .> 10)"
)
- code: |-
rxp_jl(
name = model_result,
expr = "train_model(data)",
noop_build = TRUE
)
- code: |-
rxp_jl(
name = model_output,
expr = "train_model(data)",
encoder = "save_my_obj",
user_functions = "functions.jl"
)
---
kind: function
name: rxp_qmd
exported: true
signature: rxp_qmd(name,qmd_file,additional_files = "",nix_env = "default.nix",args = "",env_var = NULL,noop_build = FALSE)
arguments:
additional_files: Character vector, additional files to include, for example a folder containing images to include in the Quarto document.
args: A character of additional arguments to be passed directly to the quarto command.
env_var: List, defaults to NULL. A named list of environment variables to set before running the Quarto render command, e.g., c(QUARTO_PROFILE = "production"). Each entry will be added as an export statement in the build phase.
name: Symbol, derivation name.
nix_env: Character, path to the Nix environment file, default is "default.nix".
noop_build: Logical, defaults to FALSE. If TRUE, the derivation produces a no-op build (a stub output with no actual build steps). Any downstream derivations depending on a no-op build will themselves also become no-op builds.
qmd_file: Character, path to .qmd file.
returns: An object of class derivation which inherits from lists.
examples:
- code: |-
rxp_qmd(
name = report,
qmd_file = "report.qmd",
additional_files = "images",
args = "--to typst"
)
- code: |-
rxp_qmd(
name = draft_report,
qmd_file = "draft.qmd",
noop_build = TRUE
)
---
kind: function
name: rxp_rmd
exported: true
signature: rxp_rmd(name,rmd_file,additional_files = "",nix_env = "default.nix",params = NULL,env_var = NULL,noop_build = FALSE)
arguments:
additional_files: Character vector, additional files to include, for example a folder containing the pictures to include in the R Markdown document.
env_var: List, defaults to NULL. A named list of environment variables to set before running the R Markdown render command, e.g., c(RSTUDIO_PANDOC = "/path/to/pandoc"). Each entry will be added as an export statement in the build phase.
name: Symbol, derivation name.
nix_env: Character, path to the Nix environment file, default is "default.nix".
noop_build: Logical, defaults to FALSE. If TRUE, the derivation produces a no-op build (a stub output with no actual build steps). Any downstream derivations depending on a no-op build will themselves also become no-op builds.
params: List, parameters to pass to the R Markdown document. Default is NULL.
rmd_file: Character, path to .Rmd file.
returns: An object of class derivation which inherits from lists.
examples:
- code: |-
rxp_rmd(
name = report,
rmd_file = "report.Rmd",
additional_files = "images"
)
- code: |-
rxp_rmd(
name = draft_report,
rmd_file = "draft.Rmd",
noop_build = TRUE
)
---
kind: function
name: rxp_trace
exported: true
signature: rxp_trace(name = NULL,dag_file = file.path("_rixpress", "dag.json"),transitive = TRUE,include_self = FALSE)
arguments:
dag_file: Character, defaults to "_rixpress/dag.json". Path to dag.json.
include_self: Logical, defaults to FALSE. If TRUE, include name itself in the results.
name: Character, defaults to NULL. Name of the derivation to inspect. If NULL, the function prints the whole pipeline (inverted global view).
transitive: Logical, defaults to TRUE. If TRUE, show transitive closure and mark transitive-only nodes with "*". If FALSE, show immediate neighbours only.
returns: 'Invisibly, a named list mapping each inspected derivation name to a list with elements: - dependencies - reverse_dependencies The function also prints a tree representation to the console.'
---
kind: function
name: adjust_import
exported: true
signature: adjust_import(old_import, new_import, project_path = ".")
arguments:
new_import: A character string representing the new import statement to replace with. For example, "from PIL import Image".
old_import: A character string representing the import statement to be replaced. For example, "import pillow".
project_path: Path to root of project, typically ".".
returns: No return value; the function performs in-place modifications of the files.
examples:
- code: adjust_import("import pillow", "from PIL import Image")
- code: adjust_import("import pillow", "from PIL import Image", project_path = "path/to/project")
---
kind: function
name: add_import
exported: true
signature: add_import(import_statement, nix_env, project_path = ".")
purpose: Add an Import Statement to Python Files in the _rixpress Folder Matching a Nix Environment Name
arguments:
import_statement: A character string representing the import statement to be added. For example, "import numpy as np".
nix_env: A character string naming the Nix environment file (e.g. "default.nix" or "py-env.nix" or similar).
project_path: Path to root of project, typically ".".
returns: No return value; the function performs in-place modifications of the files.
examples:
- code: add_import("import numpy as np", "default.nix")
- code: add_import("import numpy as np", "default.nix", project_path = "path/to/project")
---
kind: function
name: rxp_copy
exported: true
signature: rxp_copy(derivation_name = NULL,dir_mode = "0755",file_mode = "0644")
arguments:
derivation_name: The name of the derivation to copy. If empty, then all the derivations are copied.
dir_mode: Character, default "0755". POSIX permission mode to apply to directories under the copied output (including the top-level output directory).
file_mode: Character, default "0644". POSIX permission mode to apply to files under the copied output.
returns: Nothing, the contents of the Nix store are copied to the current working directory.
examples:
- code: rxp_copy()
- code: rxp_copy("mtcars")
- code: rxp_copy("my_deriv", dir_mode = "0755", file_mode = "0644")