Skip to content

Initialize Python

The initialize_python() function in the reportifyr package sets up a Python virtual environment (.venv) with predefined or user-specified Python library versions using uv. The helper function get_uv_path() fetches the location of the uv executable, prioritizing common installation paths, while the helper function get_py_version() fetches the Python version from an existing .venv/pyvenv.cfg file.


initialize_python()

R: Initializes python virtual environment
initialize_pythonR Documentation

Description

Initializes python virtual environment

Usage

initialize_python()

Examples

## Not run: 
initialize_python()

## End(Not run)

Returns

If uv is found in one of the prioritized paths:

  • path/to/uv: a character string of the path to uv

If uv is not found:

  • ERROR

Logging

  • Error: Stops execution if uv is not found.

Additional Resources

  • reportifyr GitHub: Refer to the reportifyr repository for more details.
  • Python Virtual Environments: Learn more about .venv here.
  • Introduction to uv: Learn more about uv here.