Skip to content
ocx
install

Ocx (2 of 4)

Ocxclass#

Re-exported from ocx_sdk._clientView source

patchproperty#

patch: PatchCommands

The ocx patch command group.

session_configproperty#

session_config: OcxConfig

The OcxConfig this handle spawns under.

Read-only, and the config itself is frozen: derive a variant with with_config(...) rather than trying to write through this. Not spelled config because ocx.config is the ocx config command group, and command alignment wins over the shorter name.

aboutmethod#

def about(timeout: MaybeTimeout = UNSET, retry: MaybeRetry = UNSET) -> AboutInfo

Report what this ocx build is and where it keeps its state.

Parameters

NameTypeDefaultDescription
timeoutMaybeTimeoutUNSETSeconds per attempt. Omitted takes the config’s.
retryMaybeRetryUNSETRetry policy. None opts out; omitted takes the config’s.

Returns

AboutInfo
The parsed ocx about payload.

loginmethod#

def login(registry: str | None = None, *, username: str, token: str, allow_insecure_store: bool = False, verify: bool = True, timeout: MaybeTimeout = UNSET, retry: MaybeRetry = UNSET) -> LoginResult

Authenticate to a registry and let ocx persist the credentials.

The token travels on stdin through --password-stdin, never in argv, and is redacted from logs and errors for the duration of the call.

Retries are off by default: a timed-out login exits 75, and re-sending credentials on a timeout is the auth-retry mistake the policy exists to prevent. Pass retry= explicitly to override.

Parameters

NameTypeDefaultDescription
registrystr | NoneNoneThe registry hostname. None falls back to ocx’s OCX_DEFAULT_REGISTRY.
usernamestrrequiredThe account name. Required — the SDK never prompts.
tokenstrrequiredThe password or token, written to ocx’s stdin.
allow_insecure_storeboolFalsePermit the plaintext auths fallback when no credential helper is configured.
verifyboolTrueCheck the credentials against the registry before storing them.
timeoutMaybeTimeoutUNSETSeconds per attempt. Omitted takes the config’s.
retryMaybeRetryUNSETRetry policy. Defaults to no retries.

Returns

LoginResult
The registry and username ocx recorded.

spawn_asyncmethodasync#

async def spawn_async(argv: Sequence[str], **popen_kw: Any) -> asyncio.subprocess.Process

Start an arbitrary ocx command line on the event loop.

Parameters

NameTypeDefaultDescription
argvSequence[str]requiredThe command and its arguments, without the binary.
**popen_kwAny{}Forwarded to the subprocess factory. args, shell, and executable are rejected.

Returns

asyncio.subprocess.Process
The running child.

Raises

ValueError
args, shell, or executable was passed.
TypeError
env was passed — see spawn.

with_configmethod#

def with_config(**overrides: Unpack[ConfigOverrides]) -> Ocx

Derive a handle with some configuration fields replaced.

The derived handle shares this one’s binary, host environment, on_log, and compatibility memo — only the configuration differs. Changing any of the others means constructing a fresh Ocx.

Parameters

NameTypeDefaultDescription
**overridesUnpack[ConfigOverrides]{}OcxConfig field names and their new values, as ConfigOverrides spells them.

Returns

Ocx
The derived handle.

Raises

TypeError
An override names no OcxConfig field. A type checker catches that first; the runtime guard is for callers who build the keywords dynamically.