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

*class* · *dataclass*

```python
class LockStatus
```

Re-exported from: `ocx_sdk._results`

The `lock` block of `ocx status`.

A lock file that is broken or unreadable is *payload*, not failure: ocx
still exits 0 and reports `error` here. Callers check `current`, not the
exit code.

**Attributes**

- `present` (`bool`) — A lock file exists.
- `current` (`bool`) — It matches the declaration it was generated from.
- `lock_version` (`int | None`) — Lock file format version.
- `declaration_hash` (`str | None`) — Hash recorded in the lock file.
- `declaration_hash_expected` (`str | None`) — Hash of the declaration as it reads now. Differs from `declaration_hash` exactly when `current` is false.
- `generated_by` (`str | None`) — The ocx version that wrote the lock file.
- `generated_at` (`str | None`) — When it did, as ocx spelled it.
- `error` (`str | None`) — Why the lock file could not be read, when it could not be.

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

### ocx_sdk.LockStatus.current

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

```python
current: bool = False
```

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

### ocx_sdk.LockStatus.declaration_hash

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

```python
declaration_hash: str | None = None
```

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

### ocx_sdk.LockStatus.declaration_hash_expected

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

```python
declaration_hash_expected: str | None = None
```

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

### ocx_sdk.LockStatus.error

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

```python
error: str | None = None
```

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

### ocx_sdk.LockStatus.generated_at

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

```python
generated_at: str | None = None
```

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

### ocx_sdk.LockStatus.generated_by

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

```python
generated_by: str | None = None
```

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

### ocx_sdk.LockStatus.lock_version

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

```python
lock_version: int | None = None
```

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

### ocx_sdk.LockStatus.present

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

```python
present: bool = False
```

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

### ocx_sdk.LockStatus.from_dict

*method* · *classmethod*

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

Build from the decoded `lock` object.

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