Skip to content
ocx
install

Project (4 of 6)

Projectclassdataclass#

Re-exported from ocx_sdk._clientView source

initmethod#

def init(timeout: MaybeTimeout = UNSET, retry: MaybeRetry = UNSET) -> CommandResult

Create a minimal ocx.toml in the project directory.

The one project-tier call that carries no --project: ocx init takes no flags and writes into the working directory, and naming a project would ask ocx to resolve the very file the call exists to create. This runs it with the project’s directory as its cwd instead, so the file lands where the handle points rather than wherever the caller happens to be.

Returns the raw result: ocx pins no JSON payload for init, so there is nothing to type yet.

Parameters

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

Returns

CommandResult
The exit code and whatever ocx printed.

lockmethod#

def lock(check_only: bool = False, pull: bool | None = None, platform: str | None = None, timeout: MaybeTimeout = UNSET, retry: MaybeRetry = UNSET) -> tuple[ToolRow, ...] | None

Resolve declared tags to digests and write ocx.lock.

Parameters

NameTypeDefaultDescription
check_onlyboolFalseVerify the lock is current and write nothing — ocx’s --check. Drift raises DataError; a missing lock raises ConfigError. Named apart from the check= on run, which is the subprocess.run sense of “raise on a non-zero exit”.
pullbool | NoneNoneMaterialize the resolved packages. None leaves the choice to ocx’s own default.
platformstr | NoneNoneThe platform to resolve against.
timeoutMaybeTimeoutUNSETSeconds per attempt. Omitted takes the config’s.
retryMaybeRetryUNSETRetry policy. None opts out; omitted takes the config’s.

Returns

tuple[ToolRow, ...] | None
The lock rows written, or None under check_only — ocx reports
tuple[ToolRow, ...] | None
a current lock with exit 0 and an empty body.

pullmethod#

def pull(dry_run: bool = False, groups: Iterable[str] = (), platform: str | None = None, lazy_mode: LazyMode | None = None, timeout: MaybeTimeout = UNSET, retry: MaybeRetry = UNSET) -> PullReport | tuple[DryRunEntry, ...]

Pre-warm the object store from ocx.lock.

Parameters

NameTypeDefaultDescription
dry_runboolFalseReport what would be fetched without writing. Changes the return type: ocx previews with a different upstream report at a different JSON root, so this answers a tuple of DryRunEntry rows rather than a PullReport.
groupsIterable[str]()Groups to restrict the pull to.
platformstr | NoneNoneThe platform to resolve against.
lazy_modeLazyMode | NoneNoneWhen content downloads — now, or on first use.
timeoutMaybeTimeoutUNSETSeconds per attempt. Omitted takes the config’s.
retryMaybeRetryUNSETRetry policy. None opts out; omitted takes the config’s.

Returns

PullReport | tuple[DryRunEntry, ...]
The materialized paths and any advisories — or, under dry_run,
PullReport | tuple[DryRunEntry, ...]
one row per package describing what a real pull would do.