Skip to contents

Sets up (and optionally populates) a dedicated miniconda Python environment for use from R via reticulate. This is the ecosystem's shared provisioning entry point: packages such as fafbseg, bancr and seatabler all route their Python installation through it, so users have one command to run and one environment to manage.

Usage

simple_python(
  pyinstall = c("basic", "full", "extra", "minimal", "cleanenv", "blast", "none"),
  pkgs = NULL,
  miniconda = TRUE,
  python_version = NULL
)

Arguments

pyinstall

Which package bundle to install. One of "basic", "full", "extra", "minimal", "cleanenv", "blast" or "none".

pkgs

Optional character vector of additional Python packages (pip specifications) to install into the environment.

miniconda

Whether to use the managed miniconda environment (strongly recommended). When FALSE your current Python is used as-is.

python_version

Python version to pin for the managed miniconda environment. NULL (the default) resolves to getOption("nat.python.python_version", "3.12"), falling back to any pre-set RETICULATE_MINICONDA_PYTHON_VERSION; pass a string like "3.11" to override, or NA to not pin and defer to reticulate's own default. Ignored when miniconda = FALSE.

Value

Invisibly NULL. Called for its side effect of provisioning Python.

Details

With miniconda = TRUE (the default and recommendation) a private miniconda install and r-reticulate conda environment are created/updated, independent of any system Python. The pyinstall bundles install a curated set of packages used across the FlyWire/connectomics ecosystem: "minimal" installs just pandas – nat.python's own baseline, needed by pandas2df(), with numpy coming in as its dependency; "basic" adds cloud-volume, seatable_api and CAVEclient on top; "full" adds navis + fafbseg; "extra" additionally installs skeletonisation tooling (skeletor, meshparty and friends). "none" provisions the environment but installs no bundle, which is what you want when passing your own pkgs. "cleanenv" and "blast" only print the (destructive) commands needed to remove an environment; they never delete anything themselves.

After any installation the cached module versions (forget_module_version()) and the check_module() memoise cache are cleared so that subsequent checks reflect the new environment.

The managed environment's Python interpreter is pinned to a known-good version (python_version, default "3.12") rather than whatever reticulate would otherwise select, which on a fresh install can be a bleeding-edge Python that key packages do not yet support. If an environment already exists at a different version it is kept (not silently rebuilt) and a warning points at simple_python("cleanenv").

Examples

if (FALSE) { # \dontrun{
simple_python("basic")                          # the common case
simple_python("minimal")                        # just pandas (+ numpy)
simple_python("minimal", pkgs = "seatable_api") # pandas baseline + one pkg
simple_python("none", pkgs = "seatable_api")    # just one package
} # }