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
Metadata
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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lab_device_sdk-0.1.12.tar.gz | 9.6 kB | Without provenance | Details for lab_device_sdk-0.1.12.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lab_device_sdk-0.1.12-py3-none-any.whl | Python 3 | none | any | Details for lab_device_sdk-0.1.12-py3-none-any.whl |
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
|
Security for lab-device-sdk 0.1.12
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.