Metadata-Version: 2.4
Name: devman-runtime
Version: 0.1.0
Summary: Python runtime (protocol, client, server core) for devman-gen generated device-manager bridges
Author: Kenji Shu
License-Expression: MIT
Project-URL: Repository, https://github.com/kenji0923/devman-runtime
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# devman-runtime

Python runtime library for bridges generated by [devman-gen](https://github.com/kenji0923/devman-gen).

devman-gen is a language-agnostic generator that wraps a device-control
library (e.g. `caen_libs` for CAEN HV crates) in a client/server pair with
resource-ownership management. This package is the Python-side runtime that
those generated packages import, so runtime fixes reach every bridge through
a normal dependency upgrade instead of regeneration.

## Contents

- `devman_runtime.protocol` — length-prefixed JSON over TCP.
- `devman_runtime.client` — `ManagerClient`: sessions, `acquire`/`release`
  resource ownership, `invoke`, link-group registration
  (`set_link_groups` / `list_link_groups`).
- `devman_runtime.server` — `ManagerCore` and `serve_manager`: request
  dispatch with ownership enforcement, device lifecycle/periodic hooks,
  `TripWatchdog` (powers off linked partners when a channel trips, with
  lease-based stale-group janitoring).
- `devman_runtime.db` — SQLite-backed ownership and link-group registry.

## Server features

- `trip_watchdog_interval` / `--trip-watchdog-interval`: poll registered
  link groups and power off partners of a tripped channel, even when the
  registering client is offline.
- `client_lease_sec` / `--client-lease-sec`: any authenticated request
  renews a client lease; groups of lease-expired clients are janitored when
  all their channels are off, and kept protected while energized.
- Periodic hook (`periodic_file` / `periodic_function` +
  `periodic_interval_sec`): run a user callback on an interval with access
  to the device singleton.

This package is used by, e.g., `caenhv-devman-client`.
