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

*class* · *dataclass*

```python
class StatusReport
```

Re-exported from: `ocx_sdk._results`

`ocx status` — the project's declaration, lock, and groups.

Exits 0 even when the lock is broken, so this struct is where a caller
learns something is wrong (`lock.current`, `lock.error`).

**Attributes**

- `project` (`str`) — Path to the `ocx.toml` the report describes.
- `lock` (`LockStatus`) — Lock file state.
- `groups` (`Mapping[str, GroupStatus]`) — Group name to its contents.
- `package_settings` (`Mapping[str, Mapping[str, Any]]`) — Per-package settings, carried through untyped — they are ocx's configuration surface, not the SDK's.

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

### ocx_sdk.StatusReport.groups

*attribute* · *class attribute* · *instance attribute*

```python
groups: Mapping[str, GroupStatus] = _EMPTY
```

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

### ocx_sdk.StatusReport.lock

*attribute* · *class attribute* · *instance attribute*

```python
lock: LockStatus = field(default_factory=LockStatus)
```

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

### ocx_sdk.StatusReport.package_settings

*attribute* · *class attribute* · *instance attribute*

```python
package_settings: Mapping[str, Mapping[str, Any]] = _EMPTY
```

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

### ocx_sdk.StatusReport.project

*attribute* · *instance attribute*

```python
project: str
```

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

### ocx_sdk.StatusReport.from_json

*method* · *classmethod*

```python
def from_json(raw: str) -> StatusReport
```

Parse `ocx --format json status` output.

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