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

*class* · *dataclass*

```python
class AboutInfo
```

Re-exported from: `ocx_sdk._results`

`ocx about` — the binary plus the host it is running on.

`channel` appears only when it was baked into the build. `shell` is
always on the wire and may be `null` (`about.rs:30`) — ocx detected no
shell — so it is the only one of the four leading fields that can be
`None`.

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

### ocx_sdk.AboutInfo.from_json

*method* · *classmethod*

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

Parse `ocx --format json about` output.

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

## ocx_sdk.Advisory

*class* · *dataclass*

```python
class Advisory
```

Re-exported from: `ocx_sdk._results`

Something ocx wants the caller to know about a composed environment.

**Attributes**

- `kind` (`str`) — The machine discriminator to branch on, never `message`.
- `package` (`str`) — The package the advisory is about.
- `message` (`str`) — The human rendering of the same fact.
- `key` (`str | None`) — The environment variable named, or `None` for an advisory that names none. Absent-when-unused (D7): `env.rs:175` skips the key, and the `undeclared-binaries` variant (`env.rs:189`) emits no key at all, so reading it as required crashes `env()` outright.

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

### ocx_sdk.Advisory.key

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

```python
key: str | None = None
```

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

### ocx_sdk.Advisory.kind

*attribute* · *instance attribute*

```python
kind: str
```

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

### ocx_sdk.Advisory.message

*attribute* · *instance attribute*

```python
message: str
```

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

### ocx_sdk.Advisory.package

*attribute* · *instance attribute*

```python
package: str
```

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

### ocx_sdk.Advisory.ref

*property*

```python
ref: PackageRef
```

The package the advisory is about, as a `PackageRef`.

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

### ocx_sdk.Advisory.from_dict

*method* · *classmethod*

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

Build from one decoded `advisories` entry.

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