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

*class* · *dataclass*

```python
class ToolBinding
```

Re-exported from: `ocx_sdk._results`

One tool in a group of `ocx status`, and how far it is bound.

Binding state is **key presence**, not a status field: `declared` without
`platforms` is declared-but-unlocked, `platforms` without `declared` is a
stale lock entry nothing declares any more, and both means fully bound.

**Attributes**

- `declared` (`str | None`) — The identifier `ocx.toml` declares, if it declares one.
- `platforms` (`Mapping[str, str] | None`) — Platform to digest, from the lock file, if it has an entry.

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

### ocx_sdk.ToolBinding.declared

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

```python
declared: str | None = None
```

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

### ocx_sdk.ToolBinding.platforms

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

```python
platforms: Mapping[str, str] | None = None
```

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

### ocx_sdk.ToolBinding.ref

*property*

```python
ref: PackageRef | None
```

The declared identifier as a `PackageRef`, or `None` if nothing declares it.

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

### ocx_sdk.ToolBinding.from_dict

*method* · *classmethod*

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

Build from one decoded entry of a group's `tools` object.

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