reticulate 1.31
Python Installation Management
-
reticulate will no longer prompt users to install miniconda. Instead,
reticulate will now prompt users to create a defaultr-reticulatevenv. -
The search that reticulate conducts to select which Python installation to load
has changed. See the updated Python "Order of Discover" in the "versions" vignette.
vignette("versions", package = "reticulate"). -
Updated recommendations in the "python_dependencies" vignette for how R packages
can approach Python dependency management.
vignette("python_dependencies", package = "reticulate") -
New function
virtualenv_starter(), which can be used to find a suitable
python binary for creating a virtual environmnent. This is now the default
method for finding the python binary when calling
virtualenv_create(version = <version>). -
virtualenv_create()andvirtualenv_install()gain arequirementsargument,
accepting a filepath to a python requirements file. -
virtualenv_create()gains aforceargument. -
virtualenv_install()gains apython_versionargument, allowing users to customize
which python version is used when bootstrapping a new virtual environment. -
Fixed an issue where the list of available python versions used by
install_python()would be out-of-date. -
install_python()now gives a better error message if git is not installed. -
install_python()on macOS will now will use brew, if it's available, to install
build dependencies, substantially speeding up python build times. -
New function
conda_search(), contributed by @mkoohafkan in PR #1364.
Language
-
New
[and[<-methods that invoke Python__getitem__,__setitem__and
__delitem__. The R generics[and[<-now accept python-style slice
syntax likex[1:2:3]. See examples in?py_get_item. -
py_iterator()gains aprefetchargument, primarily to avoid deadlocks
where the main thread is blocked, waiting for the iterator, which is waiting
to run on the main thread, as encountered in TensorFlow/Keras. (#1405). -
String columns from Pandas data frames containing
None,pd.NAornp.nan
are now simplified into character vectors and missing values replaced byNA
(#1428). -
Converting from Pandas data frames containing columns with Pandas nullable
data types are now correctly converted into R data.frames preserving the
missing values (#1427).
Knitr
-
The knitr engine gains a
jupyter_compatoption, enabling
reticulate to better match the behavior of Jupyter. When this chunk
option is set toTRUE, only the return value from the last
expression in a chunk is auto-printed. (#1391, #1394, contributed by
@matthew-brett) -
The knitr engine now more reliably detects and displays matplotlib
pending plots, without the need for a matplotlib artist object to be
returned as a top-level expression. E.g., the knitr engine will now
display plots when the matplotlib api returns something other than
an artist object, (plt.bar()), or the matplotlib return value is
not auto-printed due to being assigned, (x = plt.plot()), or
suppressed with a;, (plt.plot();). (#1391, #1401, contributed
by @matthew-brett) -
Fixed an issue where knitr engine would not respect chunk options
fig.width/fig.heightwhen rendering matplotlib plots. (#1398) -
Fixed an issue where the reticulate knitr engine would not capture output
printed from python. (PR #1412, fixing #1378, #331)
Miscellanous
-
Reticulate now periodically flushes python
stdoutandstderrbuffers even
while the main thread is blocked executing Python code. Streaming output
from a long-running Python function call will now appear in the R console
while the Python function is still executing. (Previously, output might not
appear until the Python function had finished and control of the main thread
had returned to R). -
Updated sparse matrix conversion routines for compatibility with
scipy 1.11.0. -
Fixed an issue where a py capsule finalizer could access the R API from
a background thread. (#1406) -
Fixed issue where R would segfault (crash) in long-lived R sessions where both
rpy2 and reticulate were in use (#1236). -
Fixed an issue where exceptions from reticulate would not be formatted properly
when running tests under testthat (r-lib/rlang#1637, #1413). -
Fixed an issue where
py_get_attr(silent = TRUE)would not return an RNULL,
if the attribute was missing, as documented. (#1413) -
Fixed an issue where
py_get_attr(silent = TRUE)would leave a python global
exception set if the attribute was missing, resulting in fatal errors when
running python under debug mode. (#1396)