Metadata-Version: 2.4
Name: spear-ai-horizon-sdk
Version: 25.1.0
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Dist: httpx>=0.28
Requires-Dist: pydantic>=2.8.0
Summary: PyO3 Python bindings for the Horizon SDK
Keywords: Horizon,SDK,Spear AI
Author-email: Spear AI <org@spear.ai>
License-Expression: LicenseRef-Proprietary
Requires-Python: >=3.11
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM

# spear-ai-horizon-sdk (Python bindings)

Python bindings for the Horizon Rust SDK, the data access layer for the Horizon
tactical data platform. The bindings are built with [PyO3](https://pyo3.rs) and
[maturin](https://www.maturin.rs), and expose the SDK's PostgreSQL, Kafka, and
Apache Iceberg data paths to Python callers.

The distribution is named `spear-ai-horizon-sdk`. The PyO3 extension is
`horizon_sdk`. The generated GraphQL client is `horizon_graphql`.

## Installation

```bash
pip install spear-ai-horizon-sdk
```

Wheels are published for `aarch64` Linux and for both `arm64` and `x86_64`
macOS. The bindings use the CPython stable ABI (`abi3`), so a single wheel per
platform supports Python 3.11 and newer. On other platforms, build from source
with a Rust toolchain (see the repository for details).

## Usage

```python
import horizon_sdk
from horizon_graphql import Client, CreateDataCollectionInput, DataCollectionInput

with Client(
    url=f"{base_url}/api/graphql",
    headers={"Authorization": f"Bearer {api_key}"},
) as client:
    result = client.create_data_collection(
        CreateDataCollectionInput(
            data_collection=DataCollectionInput(
                name="Example collection",
                platform=platform_node_id,
            )
        )
    )

collection = result.create_data_collection.data_collection
```

## GraphQL model

`horizon_graphql` is generated from the Horizon GraphQL schema and the operation
documents in `crates/horizon-sdk/graphql`. The generated modules live in
`horizon_graphql/generated`. Regenerate them after a schema or operation change:

```bash
pnpm --filter @spear-ai/horizon-sdk-codegen graphql:python
```

## Development

This package lives in the [Horizon monorepo](https://github.com/spear-ai/horizon)
at `packages/horizon-sdk/crates/horizon-ffi-python`. The Rust crate it wraps is
at `packages/horizon-sdk/crates/horizon-sdk`.

Horizon API integration tests are documented in [`tests/README.md`](tests/README.md).
That includes the CRUD harness and how to add other live tests.

