Skip to content

cmem_client.models.package¤

Marketplace package models.

A marketplace package bundles graphs, projects and Python packages into one installable unit. The packages installed in a deployment are the items of client.marketplace_packages, keyed by their package ID, while the packages a marketplace server offers are browsed through client.marketplace.

Classes:

Package¤

Bases: ReadRepositoryItem

Installed marketplace package.

Represents a package installed in Corporate Memory with all its metadata, file specifications, and version information as stored in the marketplace catalog graph.

Attributes:

Functions:

  • get_id – Get the package identifier.

get_id¤

get_id()

Get the package identifier.

Returns:

  • str – The package_id which uniquely identifies this package.

installation_metadata¤

installation_metadata: PackageInstallationMetadata | None = None

model_config¤

model_config = ConfigDict(arbitrary_types_allowed=True, str_strip_whitespace=True, extra='forbid')

package_version¤

package_version: PackageVersion

PackageInstallationMetadata¤

Bases: Model

Metadata about how and when a marketplace package was installed.

This metadata is stored as JSON in the RDF graph and used to determine whether packages can be automatically removed when they are dependencies.

Attributes:

  • dependency_level (int) – Depth at which the package was pulled in. 0 means it was installed directly, anything above that means it came in as a dependency and may be removed again with the package which required it.
  • installed_at (datetime) – When the package was installed.
  • python_dependency_already_existed (list[str]) – Python dependencies of the package which were already installed beforehand, so uninstalling must leave them alone.
  • package_dependency_already_existed (list[str]) – Marketplace packages this one depends on which were already installed beforehand.
  • origin_type (Literal[‘file’, ‘marketplace’] | None) – Where the package came from, a marketplace server or a local file. None for packages installed before this was tracked.
  • origin_url (str | None) – URL of the marketplace server the package came from. Only set when origin_type is marketplace.

dependency_level¤

dependency_level: int = Field(ge=0, default=0)

installed_at¤

installed_at: datetime = Field(default=datetime.now(tz=UTC))

is_direct_installed¤

is_direct_installed: bool

Indicates whether this package was installed directly

model_config¤

model_config = ConfigDict(extra='allow', populate_by_name=True)

origin_type¤

origin_type: Literal['file', 'marketplace'] | None = None

origin_url¤

origin_url: str | None = None

package_dependency_already_existed¤

package_dependency_already_existed: list[str] = Field(default=[])

python_dependency_already_existed¤

python_dependency_already_existed: list[str] = Field(default=[])

PackageLock¤

Bases: BaseModel

Package lock.

A lock is written for the duration of an install or uninstall, so two clients do not work on the same package at once.

Attributes:

  • package_id (str) – ID of the locked package.
  • timestamp (datetime) – When the activity started.
  • user_account (str) – Account which started the activity.
  • activity (Literal[‘Install’, ‘Uninstall’]) – What is being done, Install or Uninstall.

activity¤

activity: Literal['Install', 'Uninstall']

package_id¤

package_id: str

timestamp¤

timestamp: datetime

user_account¤

user_account: str

PackageMetadata¤

Bases: Model

Package metadata.

Attributes:

  • name (str) – Human readable name of the package.
  • description (str) – What the package provides.
  • comment (str | None) – Additional remark about the package.

comment¤

comment: str | None = None

description¤

description: str

model_config¤

model_config = ConfigDict(extra='allow', populate_by_name=True)

name¤

name: str

Comments