# 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.TestRun

*class* · *dataclass*

```python
class TestRun
```

Re-exported from: `ocx_sdk._results`

What the tested command actually did.

**Attributes**

- `exit_code` (`int`) — The command's exit status.
- `stdout` (`str`) — Its stdout, truncated if `truncated`.
- `stderr` (`str`) — Its stderr, same.
- `duration_ms` (`int`) — Wall time in milliseconds.
- `truncated` (`bool`) — Output was cut to fit the envelope.

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

### ocx_sdk.TestRun.duration_ms

*attribute* · *instance attribute*

```python
duration_ms: int
```

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

### ocx_sdk.TestRun.exit_code

*attribute* · *instance attribute*

```python
exit_code: int
```

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

### ocx_sdk.TestRun.stderr

*attribute* · *instance attribute*

```python
stderr: str
```

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

### ocx_sdk.TestRun.stdout

*attribute* · *instance attribute*

```python
stdout: str
```

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

### ocx_sdk.TestRun.truncated

*attribute* · *instance attribute*

```python
truncated: bool
```

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

### ocx_sdk.TestRun.from_dict

*method* · *classmethod*

```python
def from_dict(data: Mapping[str, Any]) -> TestRun
```

Build from the decoded `run` object.

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