Skip to main content

pre-commit Ruff uv Checked with pyright Actions status Open in Dev Containers PyPI Version Downloads Python Versions Codecov

Usage

Create a device driver by inheriting from the Device class and using decorators:

from lab_device_sdk import Device, command, settings, float_in, int_in, string_in, string_out, StringType

class MyDevice(Device):
    device_type_id = "f423f4b7-d389-42c5-bc44-eb3acee3154d"  # Use a UUID for your device type
    manufacturer = "My Company"
    model = "Model X"

    def __init__(self, device_id: str, configuration: str | None = None):
        super().__init__(device_id, configuration)

    @settings()
    @string_in("Host", "localhost", "Device host address")
    @string_in("Port", "8080", "Device port")
    @int_in("Timeout (sec)", 30, "Connection timeout")
    async def connect(self, host: str, port: str):
        # Connection logic here
        pass

    @command("Get Status", "Get device status")
    @string_out("Status")
    async def get_status(self) -> str:
        return "OK"

    @command("Set Temperature", "Set device temperature")
    @float_in("Temperature (C)", 25.0, "Device temperature")
    async def set_temperature(self, temperature: float):
        pass

    @command("Reset", "Reset the device")
    async def reset(self):
        pass

    @command("Set Mode", "Set device mode")
    @string_in("Mode", "Normal", "Device mode", options=["Normal", "Safe", "Test"], string_type=StringType.CONSTRAINED_TO_OPTIONS)
    async def set_mode(self, mode: str):
        pass

Development

This project has a dev container. If you already have VS Code and Docker installed, you can click the badge above or here to get started. Clicking these links will cause VS Code to automatically install the Dev Containers extension if needed, clone the source code into a container volume, and spin up a dev container for use.

To publish a new version of the repository, you can run the Publish workflow manually and publish to the staging registry from any branch, and you can check the 'Publish to Primary' option when on main to publish to the primary registry and create a git tag.

Updating from the template

This repository uses a copier template. To pull in the latest updates from the template, use the command: copier update --trust --conflict rej --defaults

Release files for lab-device-sdk 0.1.12

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lab-device-sdk 0.1.12
File Size Uploaded
lab_device_sdk-0.1.12.tar.gz 9.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lab-device-sdk 0.1.12
File Interpreter ABI Platform
lab_device_sdk-0.1.12-py3-none-any.whl Python 3 none any Details

Total release size: 19.6 kB

Release files / lab_device_sdk-0.1.12.tar.gz

Download URL lab_device_sdk-0.1.12.tar.gz
Size 9.6 kB
Tags Source
SHA-256 checksum
How to use checksums
95b83d705685cc946f6bb0156d2af10166001a9d91fb94bf767d6f5847c2a2cd
BLAKE2b-256 checksum
How to use checksums
d4c248e0ba402f56a394dfea2ac8dd8c634687ac5d30801737ee55d55dd5cd43
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Release files / lab_device_sdk-0.1.12-py3-none-any.whl

Download URL lab_device_sdk-0.1.12-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dda3aa9aaf33bbb05dcba5378b72dbd13919796c21180dbd67b5b624760dc45e
BLAKE2b-256 checksum
How to use checksums
e877e6ac6ee6990c1ec99b9a435e27f75dc345cc69df19f1ed873047141e9269
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Release history Release notifications | RSS feed

This release

0.1.12 This release

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page