Skip to content

cmem_client.repositories.python_packages¤

Repository for the Python packages installed in DataIntegration.

Provides PythonPackagesRepository for listing the installed packages, installing new ones from PyPI or from a wheel, and removing them again. It also reports the plugins those packages contribute to the workspace.

Examples:

List the installed packages:

>>> from cmem_client.client import Client
>>> client = Client.from_env()
>>> for name in client.python_packages:
...     print(name, client.python_packages[name].version)

Install a plugin package and reload the plugin registry:

>>> client.python_packages.install_by_name("cmem-plugin-graphql")
>>> client.python_packages.reload_plugins()
>>> client.python_packages.list_plugins()

Remove a package again:

>>> client.python_packages.delete_item("cmem-plugin-graphql")

Classes:

PythonPackagesDeleteConfig¤

Bases: DeleteConfig

Python packages deletion configuration.

Attributes:

  • model_config

PythonPackagesRepository¤

Bases: PlainListRepository, DeleteItemProtocol

Repository for python packages

Functions:

  • delete_all – Delete all items from the repository
  • delete_item – Delete an item from the repository
  • fetch_data – Fetch simple list from a JSON endpoint via a type adapter
  • install_by_file – Install a Python package by uploading a source distribution or wheel file.
  • install_by_name – Install or reinstall a Python package by pip requirement specifier.
  • items – Get the items of the repository
  • keys – Get the keys of the repository
  • list_plugins – List all discovered and registered workspace plugins.
  • reload_plugins – Reload all installed plugins and return the server response.
  • values – Get the values of the repository

Attributes:

  • logger (Logger) – Gets the client logger

delete_all¤

delete_all()

Delete all items from the repository

This overwrites the default protocol method and utilizes an internal behaviour of the server to wipe the whole python environment.

delete_item¤

delete_item(key, skip_if_missing=False, configuration=None)

Delete an item from the repository

Parameters:

  • key (str) – The key of the item to delete
  • skip_if_missing (bool) – If True, it is ignored if the deleted item even exists
  • configuration (DeleteItemConfig) – Optional configuration for deletion

Raises:

fetch_data¤

fetch_data()

Fetch simple list from a JSON endpoint via a type adapter

Use this method to fetch data when your result set is an array of objects.

install_by_file¤

install_by_file(package_path)

Install a Python package by uploading a source distribution or wheel file.

Parameters:

  • package_path (Path) – Path to a .tar.gz or .whl package file.

Returns:

  • PythonInstallResult – A PythonInstallResult with the server response and any plugin registration errors.

Raises:

install_by_name¤

install_by_name(requirement)

Install or reinstall a Python package by pip requirement specifier.

Parameters:

  • requirement (PipRequirementSpecifier) – A PEP 440/508 requirement specifier (e.g. ‘requests’, ‘requests>=2.0’).

Returns:

  • PythonInstallResult – A PythonInstallResult with the server response and any plugin registration errors.

Raises:

items¤

items()

Get the items of the repository

keys¤

keys()

Get the keys of the repository

list_plugins¤

list_plugins()

List all discovered and registered workspace plugins.

Returns:

  • list[WorkspacePlugin] – A list of WorkspacePlugin instances representing all plugins discovered
  • list[WorkspacePlugin] – from installed packages. Handles both the legacy plain-list response
  • list[WorkspacePlugin] – (DI <= 22.1) and the current object response with a plugins key
  • list[WorkspacePlugin] – (DI >= 22.1.1).

logger¤

logger: logging.Logger

Gets the client logger

reload_plugins¤

reload_plugins()

Reload all installed plugins and return the server response.

Triggers plugin discovery and registration for all installed packages. Use this after manual package changes or to recover from a partial installation state.

Returns:

  • PluginReloadResult – A PluginReloadResult which may contain plugin registration errors.

values¤

values()

Get the values of the repository

Comments