Metadata-Version: 2.4
Name: hardlabs-sdk
Version: 0.6.0
Summary: Run your tests against a HardLabs simulated board running your firmware
Author-email: HardLabs <hello@hardlabs.io>
License: Proprietary
Project-URL: Homepage, https://www.hardlabs.io
Project-URL: Documentation, https://www.hardlabs.io/docs/sdk/python
Project-URL: Board parts, https://www.hardlabs.io/docs/parts
Project-URL: Command line, https://www.hardlabs.io/docs/cli
Keywords: firmware,embedded,simulation,hardware-in-the-loop,pytest,pcb
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: Pytest
Classifier: Intended Audience :: Developers
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development :: Testing
Classifier: Topic :: Software Development :: Embedded Systems
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: simple-websocket>=1.0
Provides-Extra: test
Requires-Dist: pytest>=7; extra == "test"
Requires-Dist: pyserial>=3.5; extra == "test"

# HardLabs SDK for Python

Run your tests against a HardLabs simulation of your board, running the
firmware you'd flash: its console, its inputs, the values it reports, and its
serial ports.

**Documentation:** https://www.hardlabs.io/docs/sdk/python

```bash
pip install "hardlabs-sdk[test]"
npx hardlabs login        # once per computer; in CI, set HARDLABS_TOKEN instead
```

```python
from hardlabs_sdk import Client

with Client().start("company_name/board_name", "build/app.elf") as board:
    board.wait_for("app ready", within=5)          # simulated seconds
    board.do("bench-supply.volts", 11.5)
    assert board.read("power-monitor.bus-current") < 0.2
```

With pytest:

```python
def test_overheat_raises_the_alarm(hardlabs_board):
    hardlabs_board.do("temperature-sensor-mcp9808.overheat-75-c")
    hardlabs_board.wait_for("ALARM", within=5)
```

```bash
pytest --hardlabs-sim hardlabs/demo-board
```

- [Quickstart](https://www.hardlabs.io/docs/sdk/python/quickstart)
- [Using your own test framework](https://www.hardlabs.io/docs/sdk/python/serial-ports) over the board's serial ports
- [API reference](https://www.hardlabs.io/docs/sdk/python/reference)

Each request the SDK makes tells HardLabs which SDK function made it (for
example `Board.wait_for`) and a random id for the run, so we can see how the
SDK is used; set `HARDLABS_TELEMETRY=0` or `DO_NOT_TRACK=1` to leave them out.
See the [privacy policy](https://www.hardlabs.io/legal/privacy).
