Environments#
TL;DR#
Search paths and environments are key concepts to create portable, reproducible code, by isolating each project from others.
Methods exist in all (statistical) programming languages.
What is an environment?#
From the renv
documentation:
Isolated: Installing a new or updated package for one project won’t break your other projects, and vice versa.
Portable: Easily transport your projects from one computer to another, even across different platforms.
Reproducible: Records the exact package versions you depend on, and ensures those exact versions are the ones that get installed wherever you go.
What software supports environments?#
R:
renv
packagePython:
venv
orvirtualenv
moduleJulia:
Pkg
module
Understanding search paths#
Generically, all “environments” simply modify where the specific software searches (the “search path”) for its components, and in particular any supplementary components (packages, libraries, etc.). [3]
R:
.libPaths()
Python:
sys.path
Julia:
DEPOT_PATH
(Julia docs)