Metadata-Version: 2.4
Name: kerf-sdk
Version: 0.1.2
Summary: Python SDK for Kerf — talk to a Kerf instance over HTTP/JSON-RPC
Project-URL: Homepage, https://kerf.sh
Project-URL: Repository, https://github.com/kerf-sh/kerf
License: MIT License
        
        Copyright (c) 2026 Imran Paruk
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: respx>=0.21; extra == 'dev'
Description-Content-Type: text/markdown

# kerf-sdk

Python SDK for [Kerf](https://kerf.sh) — automate your CAD/EDA projects over HTTP/JSON-RPC.

## Install

```bash
pip install kerf-sdk
```

## Auth

Generate an API token from your workspace settings (`/w/<slug>/settings` → API Tokens), then:

```bash
export KERF_API_TOKEN=kerf_sk_...
export KERF_API_URL=https://kerf.sh   # default; omit for cloud
```

## Quickstart

```python
import kerf

k = kerf.from_env()

# list files in a project
files = k.files.list(project_id="<uuid>")
for f in files:
    print(f["name"], f["kind"])

# read a script file
content = k.files.read(project_id="<uuid>", file_id="<uuid>")

# search code across the project
results = k.files.search(project_id="<uuid>", query="extrude")

# read equations
eqs = k.equations.read(project_id="<uuid>", file_id="<uuid>")
```

## API

All calls go through `POST /v1/rpc` as JSON-RPC 2.0 envelopes. The method names match Kerf's tool registry:

| Method | Description |
|--------|-------------|
| `files.list` | List project files |
| `files.read` | Read file content |
| `files.write` | Overwrite file content |
| `files.edit` | Apply a diff-style edit |
| `files.create` | Create a new file |
| `files.delete` | Delete a file |
| `files.search` | Search code across files |
| `import_step` | Import a STEP file |
| `equations.read` | Read project equations |
| `equations.set` | Set an equation value |
| `configurations.add` | Add a configuration variant |
| `configurations.set_active` | Switch active configuration |
| `revisions.list` | List file revision history |
| `revisions.restore` | Restore a previous revision |
| `docs.search` | Search Kerf documentation |

## Low-level access

```python
result = k.invoke("files.list", {"project_id": "..."})
```

## Source

Part of the [Kerf monorepo](https://github.com/kerf-sh/kerf). SDK lives at `kerf-sdk/`.

## License

MIT
