Skip to content
ocx
install

Ocx (1 of 4)

Ocxclass#

Re-exported from ocx_sdk._clientView source
class Ocx(exe: str | Path | None = None, *, config: OcxConfig | None = None, host_env: HostEnv | None = None, on_log: Callable[[str], None] | None = None)

A handle on one ocx binary.

Construction resolves the binary once — the explicit exe, then OCX_SDK_EXE, then PATH, then ocx’s own install symlink — and pins the result for the handle’s lifetime. Every call composes its own argv and child environment, and the handle exposes no mutators, so it is safe to share across threads, tasks, and event loops.

The first typed call probes ocx version and refuses a binary older than MIN_SUPPORTED; newer than TESTED_OCX_VERSION is expected and only noted at DEBUG.

A long-lived handle keeps running the binary it resolved, so a consumer shaped like a daemon should reconstruct Ocx() periodically to pick up what an ocx self update replaced underneath it.

Attributes

NameTypeDescription
exePathThe resolved binary this handle runs.
session_configOcxConfigThe OcxConfig every call spawns under.

configproperty#

config: ConfigCommands

The ocx config command group — the managed-config tier.

exeproperty#

exe: Path

The resolved binary path, fixed at construction.

packageproperty#

package: PackageCommands

The ocx package command group — machine tier, no project path.

spawnmethod#

def spawn(argv: Sequence[str], **popen_kw: Any) -> subprocess.Popen[Any]

Start an arbitrary ocx command line and return the live Popen.

No timeout and no pumps: waiting, draining pipes, and killing belong to the caller, exactly as with a bare Popen.

Parameters

NameTypeDefaultDescription
argvSequence[str]requiredThe command and its arguments, without the binary.
**popen_kwAny{}Forwarded to Popen. args, shell, and executable are rejected; the environment is SDK-composed.

Returns

subprocess.Popen[Any]
The running child.

Raises

ValueError
args, shell, or executable was passed.
TypeError
env was passed. It is the process layer’s own parameter, so it arrives as a duplicate argument rather than a rejected one. Put what the child needs into OcxConfig or the HostEnv this handle was built with.