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

*class* · *dataclass*

```python
class InstalledPackage
```

Re-exported from: `ocx_sdk._results`

One package `package install` or `package select` put in place.

**Attributes**

- `identifier` (`str`) — The pinned identifier, `<as given>@sha256:...`.
- `path` (`str | None`) — The symlink that now points at it — `candidates/<tag>` after an install, `current` after a select — or `None` when nothing was materialized. Always-present-nullable (`install.rs:23`).
- `metadata` (`Mapping[str, Any]`) — The package's `metadata.json`, carried untyped.

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

### ocx_sdk.InstalledPackage.identifier

*attribute* · *instance attribute*

```python
identifier: str
```

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

### ocx_sdk.InstalledPackage.metadata

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

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

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

### ocx_sdk.InstalledPackage.path

*attribute* · *instance attribute*

```python
path: str | None
```

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

### ocx_sdk.InstalledPackage.ref

*property*

```python
ref: PackageRef
```

The pinned identifier, carrying its metadata.

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

### ocx_sdk.InstalledPackage.from_dict

*method* · *classmethod*

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

Build from one decoded value of the keyed object.

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