- integrations
- Python
- ocx_sdk
PackageCommands (9 of 16)
PackageCommandsclassdataclass#
ocx_sdk._clientView sourceclaimmethod#
def claim(package: str, *, repository: str, owners: Iterable[str] = (), upstream_org: str | None = None, upstream_repository_url: str | None = None, upstream_disclaimer: str | None = None, index_repo: str | None = None, forge: Forge | None = None, transport: Transport | None = None, timeout: MaybeTimeout = UNSET, retry: MaybeRetry = UNSET) -> ClaimReportClaim a package in the index so its tags can be announced (C-060).
Renders the package’s index entry and opens a pull or merge request.
mutating=True (D5): retries are off by default. Needs the same forge
credential announce does.
A package that is already claimed is refused with exit 65 and an
error envelope — not a report, and not a distinguishable subclass:
the envelope carries no detail for it, and the SDK never classifies
by message text. An idempotent CI step therefore reads as
except DataError, with error_envelope(err) as the machine handle
on what ocx said.
ocx’s --fork/--out are not wrapped; reach them through invoke.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
package | str | required | The package to claim, as <namespace>/<package>. |
repository | str | required | The physical OCI repository the bytes live in, as
oci://HOST/PATH — what every later announce resolves
tags against. |
owners | Iterable[str] | () | Owners as LOGIN or LOGIN:ID, in the order to record.
Giving any replaces the detected list; the invoking
identity is not added. A bare LOGIN is resolved against
the forge’s users API. |
upstream_org | str | None | None | The upstream organization a third-party package
mirrors. Anchors the other two upstream_* arguments —
ocx refuses either without it. |
upstream_repository_url | str | None | None | The upstream repository, as an absolute
http/https URL with no embedded credentials. |
upstream_disclaimer | str | None | None | A disclaimer recorded on the index entry. |
index_repo | str | None | None | The index repository, as [HOST/]NAMESPACE/PROJECT. |
forge | Forge | None | None | Which forge hosts it; required for a self-hosted host. |
transport | Transport | None | None | "api" (ocx’s default) or "git". |
timeout | MaybeTimeout | UNSET | Seconds per attempt. Omitted takes the config’s. |
retry | MaybeRetry | UNSET | Retry policy. Defaults to no retries. |
Returns
ClaimReport- The rendered entry: status, owners, request URL, capability checks.
Raises
AuthError- No forge credential resolved (exit 80).
DataError- The package is already claimed (exit 65).
UsageError- A self-hosted
index_repowithoutforge, or anupstream_*argument withoutupstream_org(exit 64).
description_pullmethod#
def description_pull(*refs: PackageLike, save_readme: str | Path | None = None, save_logo: str | Path | None = None, timeout: MaybeTimeout = UNSET, retry: MaybeRetry = UNSET) -> InfoResultShow the description metadata a registry holds for packages.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
*refs | PackageLike | () | Package repositories to query. |
save_readme | str | Path | None | None | Write the README to this file or directory. ocx accepts it for a single package only. |
save_logo | str | Path | None | None | Write the logo to this file or directory. Single package only, as above. |
timeout | MaybeTimeout | UNSET | Seconds per attempt. Omitted takes the config’s. |
retry | MaybeRetry | UNSET | Retry policy. None opts out; omitted takes the config’s. |
Returns
InfoResult- One entry per identifier as given,
Nonewhere the registry InfoResult- holds no description metadata.
Raises
ValueError- A save target was given for anything other than exactly one package — ocx would refuse it, and refusing here names which argument to drop.
deselectmethod#
def deselect(*refs: PackageLike, timeout: MaybeTimeout = UNSET, retry: MaybeRetry = UNSET) -> tuple[RemovalResult, ...]Drop the current symlink, leaving the candidates installed.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
*refs | PackageLike | () | Package identifiers. |
timeout | MaybeTimeout | UNSET | Seconds per attempt. Omitted takes the config’s. |
retry | MaybeRetry | UNSET | Retry policy. None opts out; omitted takes the config’s. |
Returns
tuple[RemovalResult, ...]- One row per removal.