Viewing Available Python, R, and Quarto Runtime Versions
Problem
You want to view the available versions of Python, R, and Quarto on your Connect server.
Solution
Create a table summarizing the available versions of each runtime. Do this by querying the Connect server for available runtimes, and then formatting the JSON response into a data frame.
from posit.connect import Client
import pandas as pd
def tidy_settings(runtime_type):
with Client() as client:
= client.get(f"v1/server_settings/{runtime_type}").json()
settings = pd.DataFrame(settings["installations"])
df "runtime"] = runtime_type
df[return df[["runtime", "version"]]
= ["python", "r", "quarto"]
runtimes = pd.concat([tidy_settings(rt) for rt in runtimes], ignore_index=True) result
>>> result
|runtime |version |
|:-------|:-------|
|python |3.8.17 |
|python |3.9.17 |
|python |3.10.13 |
|python |3.11.6 |
|r |4.1.3 |
|r |4.2.3 |
|r |4.3.2 |
|quarto |1.3.340 |
|quarto |1.3.450 |
|quarto |1.4.549 |
library(connectapi)
library(purrr)
<- connect()
client
<- function(type = c("r", "python", "quarto")) {
tidy_settings = match.arg(type)
type = client$GET(paste0("v1/server_settings/", type))
settings = map_dfr(settings$installations, ~as.data.frame(.))
out $runtime = type
outreturn(out[, c("runtime", "version")])
}
<- map_dfr(c("python", "r", "quarto"), tidy_settings) result
> result
|runtime |version |
|:-------|:-------|
|python |3.8.17 |
|python |3.9.17 |
|python |3.10.13 |
|python |3.11.6 |
|r |4.1.3 |
|r |4.2.3 |
|r |4.3.2 |
|quarto |1.3.340 |
|quarto |1.3.450 |
|quarto |1.4.549 |