DSS code-env package extraction
Hi All,
i am trying to extract the list of all installed packages with each and every code-env does any one has any idea how can we do so.
Basically my object is to resolve the list of vulnerable packages identified. to do so can someone please suggest how can i find or search a certain package within dss.
can some suggest me a python code or any other alternative to this
with python code i am able to list the code env but not sure how to list the installed packages within the code-env or create a combine list of all the packages for all the code env within my instance
Comments
-
Hi,
You can use something like the following Python script to get a dataframe with the unique code environments and packages listed:
The key being to use code_env.get_settings().get_required_packages()
-
Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023, Circle Member Posts: 2,591 Neuronget_required_packages() is not what you want as that shows what was requested not what was installed. The code snippet below shows how to get the actual package list installed in the code env:
import dataiku # Connect to the Dataiku instance client = dataiku.api_client() # List all code environments code_envs = client.list_code_envs() for env in code_envs: env_lang = env.get("envLang", "unknown") env_name = env.get("envName") python_interpreter = env.get("pythonInterpreter") print(f"\n=== Code Environment: {env_lang}/{env_name}/{python_interpreter} ===") # Get details for this environment code_env_handle = client.get_code_env(env_lang, env_name) try: packages = code_env_handle.get_definition()['actualPackageList'] if packages: print(f"Installed packages: {packages}") else: print("No packages installed or not retrievable") except Exception as e: print(f" Could not retrieve packages: {e}")