Python Execution

import() import_main() import_builtins() import_from_path()

Import a Python module

source_python()

Read and evaluate a Python script

repl_python()

Run a Python REPL

eng_python()

A reticulate Engine for Knitr

py_run_string() py_run_file()

Run Python code

py

Interact with the Python Main Module

Python Types

dict() py_dict()

Create Python dictionary

tuple()

Create Python tuple

iterate() iter_next() as_iterator()

Traverse a Python iterator or generator

py_iterator()

Create a Python iterator from an R function

with(<python.builtin.object>)

Evaluate an expression within a context.

Python Configuration

py_config()

Python configuration

py_discover_config()

Discover the version of Python to use with reticulate.

py_available() py_numpy_available()

Check if Python is available on this system

py_module_available()

Check if a Python module is available on this system.

use_python() use_python_version() use_virtualenv() use_condaenv() use_miniconda()

Use Python

Python Output

py_capture_output()

Capture and return Python output

py_suppress_warnings()

Suppress Python warnings for an expression

Arrays

np_array()

NumPy array

array_reshape()

Reshape an Array

Persistence

py_save_object() py_load_object()

Save and load Python objects with pickle

Low-Level Interface

py_has_attr()

Check if a Python object has an attribute

py_get_attr()

Get an attribute of a Python object

py_set_attr()

Set an attribute of a Python object

py_list_attributes()

List all attributes of a Python object

py_get_item()

Get an item from a Python object

py_set_item()

Set an item for a Python object

py_del_item()

Delete / remove an item from a Python object

py_call()

Call a Python callable object

r_to_py() py_to_r()

Convert between Python and R objects

py_is_null_xptr() py_validate_xptr()

Check if a Python object is a null externalptr

py_id()

Unique identifer for Python object

py_len()

Length of Python object

py_str()

An S3 method for getting the string representation of a Python object

py_unicode()

Convert to Python Unicode Object

py_set_seed()

Set Python and NumPy random seeds

py_last_error() py_clear_last_error()

Get or clear the last Python error encountered

py_help()

Documentation for Python Objects

py_func()

Wrap an R function in a Python function with the same signature.

py_main_thread_func()

Create a Python function that will always be called on the main thread

py_ellipsis()

The builtin constant Ellipsis

PyClass()

Create a python class

Package Installation

py_install()

Install Python packages

configure_environment()

Configure a Python Environment

virtualenv_create() virtualenv_install() virtualenv_remove() virtualenv_list() virtualenv_root() virtualenv_python() virtualenv_exists()

Interface to Python Virtual Environments

conda_list() conda_create() conda_remove() conda_install() conda_binary() conda_version() conda_python()

Interface to conda

Miniconda

install_miniconda()

Install Miniconda

miniconda_path()

Path to Miniconda

miniconda_update()

Update Miniconda