Skip to content
ocx
install

PackageCommands (9 of 16)

PackageCommandsclassdataclass#

Re-exported from ocx_sdk._clientView source

claimmethod#

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) -> ClaimReport

Claim 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

NameTypeDefaultDescription
packagestrrequiredThe package to claim, as <namespace>/<package>.
repositorystrrequiredThe physical OCI repository the bytes live in, as oci://HOST/PATH — what every later announce resolves tags against.
ownersIterable[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_orgstr | NoneNoneThe upstream organization a third-party package mirrors. Anchors the other two upstream_* arguments — ocx refuses either without it.
upstream_repository_urlstr | NoneNoneThe upstream repository, as an absolute http/https URL with no embedded credentials.
upstream_disclaimerstr | NoneNoneA disclaimer recorded on the index entry.
index_repostr | NoneNoneThe index repository, as [HOST/]NAMESPACE/PROJECT.
forgeForge | NoneNoneWhich forge hosts it; required for a self-hosted host.
transportTransport | NoneNone"api" (ocx’s default) or "git".
timeoutMaybeTimeoutUNSETSeconds per attempt. Omitted takes the config’s.
retryMaybeRetryUNSETRetry 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_repo without forge, or an upstream_* argument without upstream_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) -> InfoResult

Show the description metadata a registry holds for packages.

Parameters

NameTypeDefaultDescription
*refsPackageLike()Package repositories to query.
save_readmestr | Path | NoneNoneWrite the README to this file or directory. ocx accepts it for a single package only.
save_logostr | Path | NoneNoneWrite the logo to this file or directory. Single package only, as above.
timeoutMaybeTimeoutUNSETSeconds per attempt. Omitted takes the config’s.
retryMaybeRetryUNSETRetry policy. None opts out; omitted takes the config’s.

Returns

InfoResult
One entry per identifier as given, None where 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

NameTypeDefaultDescription
*refsPackageLike()Package identifiers.
timeoutMaybeTimeoutUNSETSeconds per attempt. Omitted takes the config’s.
retryMaybeRetryUNSETRetry policy. None opts out; omitted takes the config’s.

Returns

tuple[RemovalResult, ...]
One row per removal.