Metadata-Version: 2.4
Name: fieldbench-sdk
Version: 0.2.1
Summary: Typed Python SDK for the Fieldbench CAN/CAN-FD/UDS/STL bus engineering platform
Author-email: ALGD LTD <support@fieldbench.dev>
License: Apache-2.0
Project-URL: Homepage, https://fieldbench.dev
Project-URL: Documentation, https://github.com/Huckcity/fieldbench/blob/main/docs/MANUAL.md
Project-URL: Repository, https://github.com/Huckcity/fieldbench
Keywords: can,can-fd,dbc,arxml,uds,stl,automotive,hil,blf,mf4,fieldbench
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Manufacturing
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Software Development :: Testing
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# Fieldbench Python SDK (`fieldbench`)

Zero-dependency, fully typed Python 3.10+ SDK for the [Fieldbench](https://fieldbench.dev) bus engineering platform.

## Install

```bash
pip install ./sdk/python
```

No third-party runtime dependencies are installed — everything runs on the Python standard library (`subprocess`, `urllib.request`, `dataclasses`, `json`).

## Quick Start

### Authoring an STL Assertion Suite

```python
from fieldbench import FieldbenchCli, StlBuilder

suite = (
    StlBuilder("EV-600 Thermal & Brake Compliance", description="HIL gate")
    .always("BMS_PackStatus.PackTemp <= 60.0", name="Pack Thermal Ceiling", unit="°C", severity="critical")
    .latency("Chassis_Pedals.BrakePedal > 0.2", "Chassis_Lights.BrakeLight == 1", within_ms=50, name="Brake Light Latency")
    .cycle_jitter_below(0x100, 2, name="VCU Cycle Jitter")
    .alive_counter(0x100, "AliveCounter", name="VCU Alive Counter")
)
suite.write("ev600_safety.fbt")

cli = FieldbenchCli()
report = cli.assert_run("capture.blf", "ev600_safety.fbt", schema_path="ev600.dbc", junit_out="junit.xml")
assert report.all_passed, [v.name for v in report.verdicts if not v.passed]
```

### Connecting to a Fieldbench Team Hub

```python
from fieldbench import FieldbenchHubClient

hub = FieldbenchHubClient("http://127.0.0.1:8080")
hub.login("hil-ci@example.com", "secret")
proj = hub.create_project("EV-600 HIL")
report = hub.run_assert(proj["id"], trace_id="tr_01", suite_fbt=suite.to_fbt())
```

## Running Tests

```bash
python3 -m unittest discover -s sdk/python/tests -v
```
