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

*class* · *dataclass*

```python
class EnvReport
```

Re-exported from: `ocx_sdk._results`

`ocx env` and `ocx package env` — the same five-array envelope, both tiers.

Iterating the report iterates `entries`: composing an environment is what
it is for, and the other four arrays are description.

**Attributes**

- `entries` (`tuple[EnvEntry, ...]`) — The `[env]` contributions, in declaration order.
- `binaries` (`tuple[PackageBinding, ...]`) — Executables the packages put on PATH. Pre-1.0, may break.
- `entrypoints` (`tuple[PackageBinding, ...]`) — Named entrypoints the packages declare. Pre-1.0, may break.
- `integrations` (`tuple[Integration, ...]`) — Tool integrations, payloads untyped. Pre-1.0, may break.
- `advisories` (`tuple[Advisory, ...]`) — Warnings about the composition. Pre-1.0, may break.

The four non-entry arrays carry ocx's `package which`-style caveat: they
are not on ocx's durable-anchor list, so their shape may change in a minor
release. `entries` is the part the SDK depends on.

> **Example**
>
> ```pycon
> >>> wire = '{"entries": [{"key": "TOOL", "type": "constant", "value": "1"}],'
> >>> wire += ' "binaries": [], "entrypoints": [], "integrations": [], "advisories": []}'
> >>> [entry.key for entry in EnvReport.from_json(wire)]
> ['TOOL']
> 
> ```

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

### ocx_sdk.EnvReport.advisories

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

```python
advisories: tuple[Advisory, ...] = ()
```

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

### ocx_sdk.EnvReport.binaries

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

```python
binaries: tuple[PackageBinding, ...] = ()
```

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

### ocx_sdk.EnvReport.entries

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

```python
entries: tuple[EnvEntry, ...] = ()
```

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

### ocx_sdk.EnvReport.entrypoints

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

```python
entrypoints: tuple[PackageBinding, ...] = ()
```

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

### ocx_sdk.EnvReport.integrations

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

```python
integrations: tuple[Integration, ...] = ()
```

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