Metadata-Version: 2.4
Name: siliconrig
Version: 0.2.0
Summary: Python SDK and pytest fixtures for siliconrig hardware-in-the-loop testing
Project-URL: Homepage, https://siliconrig.dev
Project-URL: Documentation, https://siliconrig.dev/docs/guides/python-sdk
Project-URL: Repository, https://github.com/siliconrig/srig-python
Author: RAWS Consulting
License-Expression: MIT
License-File: LICENSE
Keywords: HIL,MCU,embedded,hardware-in-the-loop,pytest,testing
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: Pytest
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Testing
Classifier: Topic :: System :: Hardware
Requires-Python: >=3.10
Requires-Dist: httpx<1,>=0.27
Requires-Dist: websockets<15,>=13.0
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.8; extra == 'dev'
Description-Content-Type: text/markdown

# siliconrig

Python SDK for [siliconrig](https://siliconrig.dev) — remote access to MCU development boards.

Use it in scripts, automation, or as a pytest plugin for hardware-in-the-loop testing.

## Install

```bash
pip install siliconrig
```

## Quick start

```python
from siliconrig import Client

client = Client()

with client.session(board="esp32s3") as session:
    session.flash("firmware.bin")
    session.serial.expect("Ready", timeout=10)
    session.serial.send("status\n")
    print(session.serial.read_until("OK", timeout=5))
```

Or use the `Board` shorthand:

```python
from siliconrig import Board

with Board("esp32-s3", firmware="build/app.bin") as board:
    board.expect("System ready", timeout=5)
    board.send("gpio set 4 1\n")
    board.expect("GPIO4=HIGH", timeout=2)
```

## pytest plugin

The package includes a pytest plugin that registers automatically. Use it with custom fixtures:

```python
import pytest
from siliconrig import Board

@pytest.fixture
def board():
    with Board("esp32-s3", firmware="build/app.bin") as b:
        yield b

def test_boot_ok(board):
    assert board.expect("System ready", timeout=5)
```

Or use the built-in `siliconrig_board` fixture via CLI options:

```bash
pytest --siliconrig-board esp32s3 --siliconrig-firmware build/app.bin tests/hil/
```

## Authentication

Set your API key via environment variable:

```bash
export SRIG_API_KEY=key_...
```

Or pass it directly:

```python
client = Client(api_key="key_...")
```

## Documentation

- [Python SDK guide](https://siliconrig.dev/docs/guides/python-sdk)
- [CI/CD integration](https://siliconrig.dev/docs/guides/cicd)
