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_eval()

Evaluate a Python Expression

py

Interact with the Python Main Module

Python Types

dict() py_dict()

Create Python dictionary

tuple()

Create Python tuple

as_iterator() iterate() iter_next()

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

install_python()

Install Python

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

py_exe()

Python executable

py_version()

Python version

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

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_del_attr()

Delete an attribute of a Python object

py_list_attributes()

List all attributes of a Python object

py_get_item() py_set_item() py_del_item() `[`(<python.builtin.object>) `[<-`(<python.builtin.object>)

Get/Set/Delete 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

as.character(<python.builtin.bytes>) as.raw(<python.builtin.bytes>)

Convert Python bytes to an R character or raw vector

as.character(<python.builtin.str>)

Convert a Python string to an R Character Vector

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_bool()

Python Truthiness

py_repr() py_str()

String representation of a python object.

py_unicode()

Convert to Python Unicode Object

py_set_seed()

Set Python and NumPy random seeds

py_clear_last_error() py_last_error()

Get or (re)set 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()

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

py_ellipsis()

The builtin constant Ellipsis

py_none()

The Python None object

PyClass()

Create a python class

py_function_custom_scaffold()

Custom Scaffolding of R Wrappers for Python Functions

nameOfClass(<python.builtin.type>)

nameOfClass() for Python objects

`==`(<python.builtin.object>) `!=`(<python.builtin.object>) `<`(<python.builtin.object>) `>`(<python.builtin.object>) `>=`(<python.builtin.object>) `<=`(<python.builtin.object>) `+`(<python.builtin.object>) `-`(<python.builtin.object>) `*`(<python.builtin.object>) `/`(<python.builtin.object>) `%/%`(<python.builtin.object>) `%%`(<python.builtin.object>) `^`(<python.builtin.object>) `&`(<python.builtin.object>) `|`(<python.builtin.object>) `!`(<python.builtin.object>) `%*%`(<python.builtin.object>)

S3 Ops Methods for Python Objects

Package Installation

py_install()

Install Python packages

py_list_packages()

List installed Python packages

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

Interface to Python Virtual Environments

configure_environment()

Configure a Python Environment

conda_list() conda_create() conda_clone() conda_export() conda_remove() conda_install() conda_binary() conda_exe() conda_version() conda_update() conda_python() conda_search() condaenv_exists()

Conda Tools

conda_run2()

Run a command in a conda environment

Miniconda

install_miniconda()

Install Miniconda

miniconda_uninstall()

Remove Miniconda

miniconda_path()

Path to Miniconda

miniconda_update()

Update Miniconda