Viewing Packages
Problem
You want to view the packages installed on Connect.
Solution
You must have administrator privileges to view packages.
Use packages.fetch to view the packages installed by Connect. The fetch method accepts query parameters for filtering.
Here we fetch instances of the Python requests package.
from posit import connect
LANGUAGE = "python"
NAME = "requests"
client = connect.Client()
packages = client.packages.fetch(language=LANGUAGE, name=NAME)Let’s view the results using Pandas. Here we can see the each version of requests installed on Connect along with other useful information:
- language: Programming language ecosystem, options are ‘python’ and ‘r’.
- language_version: Programming language version.
- name: The package name.
- version: The package version.
- hash: Package description hash for R packages.
- bundle_id: The unique identifier of the bundle this package is associated with.
- app_id: The numerical identifier of the application this package is associated with.
- app_guid: The numerical identifier of the application this package is associated with.
>>> pd.DataFrame(packages)
language language_version name version hash bundle_id app_id app_guid
0 python 3.7.7 requests 2.18.4 None 6865 3766 5ca31659-a521-4d10-9d87-b234c2766be6
1 python 3.7.7 requests 2.18.4 None 6925 3788 23998ea3-2490-4a4f-8a7e-bed7e60a6768
2 python 3.7.7 requests 2.18.4 None 6929 3792 35cdf57d-4226-4b1b-ab75-8e5ec65ef6ae
3 python 3.7.7 requests 2.18.4 None 6932 3789 ffdd3dd2-54d9-404d-a077-5c623addc58f
4 python 3.7.7 requests 2.18.4 None 7088 3868 b855608c-3424-4b29-abff-cdfe0b770d3d
.. ... ... ... ... ... ... ... ...
410 python 3.10.10 requests 2.32.3 None 169488 62273 47f5bb56-8639-4ff3-af5d-a233a6171ea7
411 python 3.11.3 requests 2.32.3 None 169489 62449 0ebe00cf-50e9-4b19-bba5-092f2c196b6a
412 python 3.11.3 requests 2.32.3 None 169490 62450 b4badc72-43d9-4aae-8a0f-d4fd95940947
413 python 3.11.3 requests 2.32.3 None 169497 62457 b9fb59a4-0c12-4ed9-9eca-d71facb1a88f
414 python 3.10.10 requests 2.32.3 None 169563 34226 ab9d5968-0cf3-4519-a5b2-400347931258
[415 rows x 8 columns]The get_packages() function returns a data frame of all packages in use on the Connect server. You can optionally pass in a name parameter to filter by package name.
client <- connect()
PACKAGE_NAME <- "requests"
packages <- get_packages(client, name = PACKAGE_NAME)The package data includes the following fields:
language: Programming language ecosystem, options are ‘python’ and ‘r’.language_version: Programming language version.name: The package name.version: The package version.hash: Package description hash for R packages.bundle_id: The unique identifier of the bundle this package is associated with.content_id: The numerical identifier of the application this package is associated with.content_guid: The numerical identifier of the application this package is associated with.
> packages
# A tibble: 501 × 8
language language_version name version hash bundle_id content_id content_guid
<chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
1 python 3.7.7 requests 2.18.4 NA 6865 3766 5ca31659-a521-4d10-9d87-b234c2766be6
2 python 3.7.7 requests 2.18.4 NA 6925 3788 23998ea3-2490-4a4f-8a7e-bed7e60a6768
3 python 3.7.7 requests 2.18.4 NA 6929 3792 35cdf57d-4226-4b1b-ab75-8e5ec65ef6ae
4 python 3.7.7 requests 2.18.4 NA 6932 3789 ffdd3dd2-54d9-404d-a077-5c623addc58f
5 python 3.7.7 requests 2.18.4 NA 7088 3868 b855608c-3424-4b29-abff-cdfe0b770d3d
6 python 3.7.7 requests 2.18.4 NA 7093 3871 f72fa1ea-9717-45a0-b57a-bbb8b8f9b96a
7 python 3.7.7 requests 2.18.4 NA 7095 3873 24474def-ba44-43bc-830d-85ae87b0c22c
8 python 3.7.7 requests 2.18.4 NA 7097 3875 59743b57-9634-4822-985d-c6400d405d4b
9 python 3.7.7 requests 2.18.4 NA 7098 3876 bccea106-22c6-45e9-a544-e5ae03a4d99d
10 python 3.7.7 requests 2.18.4 NA 7106 3869 c10dc346-f4b4-483a-a861-04e0981013e2
# ℹ 491 more rowsDiscussion
Searching for packages by language, name, or version is essential for addressing risks during CVE and security events. This approach helps administrators pinpoint affected content and the environments that use vulnerable packages, empowering them to take focused actions like upgrades, patches, or isolating impacted systems.