Viewing Packages

Problem

You want to view the packages installed on Connect.

Solution

Warning

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]

Discussion

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.