Skip to main content

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

Project description

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)

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.1.0.tar.gz (42.7 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.1.0-py3-none-any.whl (59.4 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for bioexperiment_lab_devices-0.1.0.tar.gz
Algorithm Hash digest
SHA256 000ec85e62da083e9ec515f11ffa024cb8b7aaf30605cc5b5efaf9e400404407
MD5 9c38458d0474421166b0a6059d692603
BLAKE2b-256 0d0fb43600ee69c066b7ea05bff76d5e2eaa6cb341890787ac231896e4370290

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bioexperiment_lab_devices-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f1bd013664cddee5dd8d1e966ef9e5947021769b95e504b1c7c0d60e66bd04a5
MD5 9d702eb7e30d14c6d0bfa7e8f60bbcb4
BLAKE2b-256 426b7520e3f38add3ddbb1daf5e27f43041aa142f460d53960f23e98b0950b15

See more details on using hashes here.

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