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
import pprint
= "ghcr.io/rstudio/content-pro:r4.1.3-py3.10.4-bionic"
IMAGE_NAME
= connect.Client()
client
= None
image = client.get("/v1/environments").json()
all_images = next(
image for key in ["python", "quarto", "r"]} for i in all_images if i["title"] == IMAGE_NAME),
({key: i[key] None
)
>>> image
'python': {'installations': [{'version': '3.10.4',
{'path': '/opt/python/3.10.4/bin/python3'}]},
'quarto': {'installations': [{'version': '1.0.35',
'path': '/opt/quarto/bin/quarto'}]},
'r': {'installations': [{'version': '4.1.3', 'path': '/opt/R/4.1.3/bin/R'}]}}
library(connectapi)
library(purrr)
<- "ghcr.io/rstudio/content-pro:r4.1.3-py3.10.4-bionic"
IMAGE_NAME
<- connect()
client <- client$GET("/v1/environments")
all_images <- map_chr(all_images, ~ .$title)
image_names
<- all_images[[match(IMAGE_NAME, image_names)]]
image <- image[c("python", "quarto", "r")] image
> 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
- Viewing Container Image Usage for viewing a list of image names in use and how many content items use each.