Viewing Execution Environment Runtimes

Problem

You want to view the Python, R, and Quarto versions available in a given execution environment.

Solution

Use the GET /v1/environments endpoint to get details on all environments. Then, filter the resulting data for your image of interest.

from posit import connect

IMAGE_NAME = "ghcr.io/rstudio/content-pro:r4.1.3-py3.10.4-bionic"

client = connect.Client()

environment = client.environments.find_by(name=IMAGE_NAME)
>>> environment
{
    "id": "3",
    "guid": "5c47281b-d8ac-4386-b332-c9f78454440d",
    "created_time": "2024-07-09T19:09:34Z",
    "updated_time": "2024-07-09T19:09:34Z",
    "title": "Ubuntu 18.04",
    "description": "Ubuntu 18.04 - R 4.1.3 / Python 3.10.4",
    "cluster_name": "Kubernetes",
    "name": "ghcr.io/rstudio/content-pro:r4.1.3-py3.10.4-bionic",
    "environment_type": "Kubernetes",
    "matching": "exact",
    "supervisor": None,
    "python": {
        "installations": [
            {
                "version": "3.10.4",
                "path": "/opt/python/3.10.4/bin/python"
            }
        ]
    },
    "quarto": {
        "installations": None
    },
    "r": {
        "installations": [
            {
                "version": "4.1.3",
                "path": "/opt/R/4.1.3/bin/R"
            }
        ]
    },
    "tensorflow": {
        "installations": None
    },
}
library(connectapi)
library(purrr)

IMAGE_NAME <- "ghcr.io/rstudio/content-pro:r4.1.3-py3.10.4-bionic"

client <- connect()
all_images <- client$GET("/v1/environments")
image_names <- map_chr(all_images, ~ .$title)

image <- all_images[[match(IMAGE_NAME, image_names)]]
image <- image[c("python", "quarto", "r")]
> image
$python
$python$installations
$python$installations[[1]]
$python$installations[[1]]$version
[1] "3.10.4"

$python$installations[[1]]$path
[1] "/opt/python/3.10.4/bin/python3"




$quarto
$quarto$installations
$quarto$installations[[1]]
$quarto$installations[[1]]$version
[1] "1.0.35"

$quarto$installations[[1]]$path
[1] "/opt/quarto/bin/quarto"




$r
$r$installations
$r$installations[[1]]
$r$installations[[1]]$version
[1] "4.1.3"

$r$installations[[1]]$path
[1] "/opt/R/4.1.3/bin/R"

See also