Metadata-Version: 2.4
Name: bioexperiment-lab-devices
Version: 0.3.0
Summary: Async Python library to discover and manage lab devices (pump, valve, densitometer).
License-Expression: MIT
License-File: LICENSE
Keywords: lab,automation,devices,async,httpx
Author: khamitovdr
Author-email: khamitov.personal@gmail.com
Requires-Python: >=3.11
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Framework :: AsyncIO
Classifier: Typing :: Typed
Provides-Extra: dev
Requires-Dist: httpx (>=0.27)
Requires-Dist: mypy (>=1.8) ; extra == "dev"
Requires-Dist: pytest (>=8) ; extra == "dev"
Requires-Dist: pytest-asyncio (>=0.23) ; extra == "dev"
Requires-Dist: ruff (>=0.4) ; extra == "dev"
Project-URL: Homepage, https://github.com/bioexperiment-lab-devices/lab-devices
Project-URL: Issues, https://github.com/bioexperiment-lab-devices/lab-devices/issues
Project-URL: Repository, https://github.com/bioexperiment-lab-devices/lab-devices
Description-Content-Type: text/markdown

# lab_devices

[![CI](https://github.com/bioexperiment-lab-devices/lab-devices/actions/workflows/ci.yml/badge.svg)](https://github.com/bioexperiment-lab-devices/lab-devices/actions/workflows/ci.yml)
[![PyPI version](https://img.shields.io/pypi/v/bioexperiment-lab-devices.svg)](https://pypi.org/project/bioexperiment-lab-devices/)

Async Python library to discover and manage lab devices — peristaltic pumps,
distribution valves, and densitometers — over the SerialHop / lab-bridge API.

## Install

    pip install bioexperiment-lab-devices    # import as: import lab_devices

For development (runtime + dev deps):

    poetry install --all-extras
    # or, without Poetry:
    pip install -e ".[dev]"

## Core usage (host + port)

```python
import asyncio
from lab_devices import LabClient

async def main():
    async with LabClient("chisel", 8089) as lab:
        pump = lab.pump(1)
        job = await pump.dispense(volume_ml=10, speed_ml_min=3.0)
        result = await job.result()
        print(result.dispensed_ml)

asyncio.run(main())
```

## Server-only discovery (inside labnet)

```python
from lab_devices.discovery import LabRegistry

async with LabRegistry() as reg:            # LAB_DEVICES_DISCOVERY_URL overrides the endpoint
    print(await reg.list_labs())
    lab = await reg.connect("khamit_desktop")
    async with lab:
        await lab.densitometer(1).measure()
```

Discovery uses the internal, unauthenticated roster endpoint and needs no token.
It only works from inside the lab-bridge network.

## Development

    poetry run pytest        # hermetic; no hardware needed
    poetry run mypy
    poetry run ruff check .

