Skip to main content

Async Python library to discover and manage lab devices (pump, valve, densitometer).

Project description

lab_devices

CI PyPI version

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)

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)

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 .

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bioexperiment_lab_devices-0.2.0.tar.gz (43.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bioexperiment_lab_devices-0.2.0-py3-none-any.whl (60.3 kB view details)

Uploaded Python 3

File details

Details for the file bioexperiment_lab_devices-0.2.0.tar.gz.

File metadata

File hashes

Hashes for bioexperiment_lab_devices-0.2.0.tar.gz
Algorithm Hash digest
SHA256 d2d7d4409125d5ac62c918c8eaacc7243ab28d87d8a7f50f75ac8bd6ed0dc69e
MD5 e54ad8b81cdd3d34d85c3d07fc3ae69d
BLAKE2b-256 d890d7f8035853048187da721aab67efd1e71b2e86547ce927e577866197eebb

See more details on using hashes here.

Provenance

The following attestation bundles were made for bioexperiment_lab_devices-0.2.0.tar.gz:

Publisher: release-please.yml on bioexperiment-lab-devices/lab-devices

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bioexperiment_lab_devices-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for bioexperiment_lab_devices-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 399f8320a7f066a0f4d5a55927fc15357804c99a16bd3019912ba0df6d2b66cb
MD5 665dadd913be9c162f705a8bd5dea741
BLAKE2b-256 d183dd86ce73425403687b5ee6b10622f51dae374dd2a3cc3a16c746eb90b737

See more details on using hashes here.

Provenance

The following attestation bundles were made for bioexperiment_lab_devices-0.2.0-py3-none-any.whl:

Publisher: release-please.yml on bioexperiment-lab-devices/lab-devices

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page