Metadata-Version: 2.4
Name: harp-serial
Version: 0.5.0
Summary: Serial transport for Harp devices
Author-email: harp-tech <contact@harp-tech.org>
License-Expression: MIT
Project-URL: Homepage, https://harp-tech.org/
Project-URL: Repository, https://github.com/harp-tech/python/
Project-URL: Documentation, https://harp-tech.org/python/
Project-URL: Bug Tracker, https://github.com/harp-tech/python/issues
Project-URL: Changelog, https://github.com/harp-tech/python/releases
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Developers
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: System :: Hardware :: Hardware Drivers
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: harp-protocol
Requires-Dist: harp-device
Requires-Dist: pyserial>=3.5
Dynamic: license-file

# harp-serial

Serial transport for [`harp-device`](https://github.com/harp-tech/python/tree/main/src/packages/harp-device). Provides `SerialTransport` and the `open_device` factory, which pairs a device module or a `Device` class with a serial port. This is the package that pulls in `pyserial`.

## Usage

Like the builtin `open`, the returned device is connected and ready. Use it in a `with` block for guaranteed cleanup:

```python
from harp import serial
from harp.device import behavior, core

# Use "COMx" on Windows, "/dev/ttyUSBx" on Linux.
with serial.open_device(behavior, port="COM3") as device:
    print(device.read(core.WhoAmI).payload)         # a core register
    print(device.read(behavior.AnalogData).payload) # a device register
```

Passing a device module validates the device identity on open. Pass a `Device` subclass instead to preserve its own type, or omit the argument entirely for schema-free access, which skips the identity check.

`harp-serial` is released as open source under the [MIT license](https://github.com/harp-tech/python/blob/main/LICENSE). Bug reports and contributions are welcome at [the GitHub repository](https://github.com/harp-tech/python).
