# ocx_sdk

*module*

Python SDK for [OCX](https://github.com/ocx-sh/ocx).

`ocx-sdk` drives the ocx binary rather than reimplementing it: ocx owns
resolution, verification, and the identifier grammar, and this package gives
you typed, CWD-independent handles over the commands it exposes.

```python
from ocx_sdk import Ocx, bootstrap

ocx = Ocx(exe=bootstrap.ensure())
project = ocx.project("/srv/build")
project.pull()
project.exec(["task", "verify"])
```

**This module is the API.** Everything listed in `__all__` is the stable
surface; every other module is underscored and package-private, and the one
public submodule is `ocx_sdk.bootstrap`. Reaching into an underscored path
means the next release may move it without notice — pre-1.0, breaking
changes ship without shims.

Start at `Ocx` for the runtime API and `bootstrap.ensure` for provisioning.

[View source](https://github.com/ocx-sh/ocx-sdk-python/blob/main/src/ocx_sdk/__init__.py#L1-L1)

## ocx_sdk.OcxExecutionError

*class*

```python
class OcxExecutionError(OcxError)
```

Bases: `ocx_sdk._errors.OcxError`

Re-exported from: `ocx_sdk._errors`

Base for failures an ocx process raised — non-zero exits and timeouts.

`except OcxExecutionError` is the catch shape a caller usually wants: it
covers both a process that failed and one that never finished.

**Attributes**

- `argv` (`tuple[str, ...]`) — The argv that ran, with secrets already redacted by `_process`.
- `stderr` (`str`) — Captured stderr in full; the message shows only its tail.

[View source](https://github.com/ocx-sh/ocx-sdk-python/blob/main/src/ocx_sdk/_errors.py#L89-L115)

### ocx_sdk.OcxExecutionError.argv

*attribute* · *instance attribute*

```python
argv: tuple[str, ...] = tuple(argv)
```

[View source](https://github.com/ocx-sh/ocx-sdk-python/blob/main/src/ocx_sdk/_errors.py#L105-L105)

### ocx_sdk.OcxExecutionError.stderr

*attribute* · *instance attribute*

```python
stderr: str = stderr
```

[View source](https://github.com/ocx-sh/ocx-sdk-python/blob/main/src/ocx_sdk/_errors.py#L106-L106)

## ocx_sdk.OcxNotFoundError

*class*

```python
class OcxNotFoundError(OcxError)
```

Bases: `ocx_sdk._errors.OcxError`

Re-exported from: `ocx_sdk._errors`

No ocx binary could be discovered.

[View source](https://github.com/ocx-sh/ocx-sdk-python/blob/main/src/ocx_sdk/_errors.py#L348-L351)
