Skip to content

Set up the Python environment for r-containerio using uv

In the location defined via project_path:

  • Creates a local virtual environment via uv (if needed),
  • synchronizes the Python dependencies defined in the packaged pyproject.toml and uv.lock shipped with r-containerio via uv sync (after copying these two files to the project_path),
  • and configures reticulate to use the resulting interpreter.
setup_containerio_python(
project_path = ".",
python_version = "3.14",
envname = ".venv",
groups = NULL
)
Argument Description
project_path Path to the project root. Defaults to "." (current directory).
python_version Python version to use for the virtual environment, default: "3.14".
envname Name of the virtual environment to install the Python dependencies to. Defaults to: “.venv”.
groups Optional character vector of dependency groups to install via uv sync --group. Development dependencies are only installed if specified here, otherwise --no-dev is appended to the uv sync command.

Invisibly returns the path to the configured Python interpreter.

If you want to work with this virtual environment, this function should be run directly after loading the r-containerio package.

setup_containerio_python()
setup_containerio_python(groups = "dev")