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

*class* · *dataclass*

```python
class VersionInfo
```

Re-exported from: `ocx_sdk._results`

`ocx version` under `--format json`.

Only `version` is guaranteed; everything else depends on how the binary was
built. The three sub-objects stay mappings on purpose — they are build
provenance, nothing in the SDK dispatches on their fields, and modelling
them would pin a schema ocx explicitly keeps open for extension.

Note that `Ocx.version()` reads the *plain* output instead: a bare semver
line is ocx's documented stable contract (design §11).

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

### ocx_sdk.VersionInfo.build

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

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

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

### ocx_sdk.VersionInfo.cargo_pkg_version

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

```python
cargo_pkg_version: str | None = None
```

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

### ocx_sdk.VersionInfo.channel

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

```python
channel: str | None = None
```

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

### ocx_sdk.VersionInfo.ci

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

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

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

### ocx_sdk.VersionInfo.commit

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

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

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

### ocx_sdk.VersionInfo.version

*attribute* · *instance attribute*

```python
version: str
```

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

### ocx_sdk.VersionInfo.from_json

*method* · *classmethod*

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

Parse `ocx --format json version` output.

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