- integrations
- Python
- ocx_sdk
Ocx (1 of 4)
Ocxclass#
ocx_sdk._clientView sourceclass 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
| Name | Type | Description |
|---|---|---|
exe | Path | The resolved binary this handle runs. |
session_config | OcxConfig | The OcxConfig every call spawns under. |
configproperty#
config: ConfigCommandsThe ocx config command group — the managed-config tier.
exeproperty#
exe: PathThe resolved binary path, fixed at construction.
packageproperty#
package: PackageCommandsThe 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
| Name | Type | Default | Description |
|---|---|---|---|
argv | Sequence[str] | required | The command and its arguments, without the binary. |
**popen_kw | Any | {} | Forwarded to Popen. args, shell, and
executable are rejected; the environment is SDK-composed. |
Returns
subprocess.Popen[Any]- The running child.
Raises
ValueErrorargs,shell, orexecutablewas passed.TypeErrorenvwas 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 intoOcxConfigor theHostEnvthis handle was built with.