Device-package integration contract (reproducibility specification)
This document is a contract for future developers and AI assistants to reproduce the same architecture, without inventing requirements or claiming unimplemented integration work is complete.
Invariants
The single common
DeviceProxyis a factory, not a transport abstraction. It looks up a callable by device-class name and forwards all arguments unchanged.Device-class names are unique. Reject duplicates; never use
(device_class, transport)composite keys.Each device package provides dedicated clients. Use actual classes such as
AsyncCobottaClientandSyncCobottaClient; do not invent aCobottaClientclass.Async/sync selection belongs in a registered factory.
make_async_sync_factoryis an optional helper for HTTP/gRPC pairs. Do not force Tango to use it.Preserve device-specific constructor arguments. The common factory must not interpret or fill
config,api_spec, addresses, etc.No auto-discovery: no
entry_points, package enumeration, database, or network discovery. Users explicitly import/initialize known device packages.Preserve existing single-device usage: direct client instantiation, package-local proxy, and common proxy are all valid.
Keep transport frameworks independent. The common package must not import HTTP/gRPC/Tango; transport and dispatch stay in their frameworks.
Do not claim
.pyiintegration is complete. It remains open work.
Implementation procedure
Inspect the actual source to identify device class, dedicated client classes, and constructor signatures.
Define a callable to instantiate dedicated clients. Existing async/sync pairs may use
make_async_sync_factory.Register with
register_device_proxy("UniqueDeviceClass", creator)during explicit package import or initialization.Test creating at least two distinct device classes in the same process via the common
DeviceProxy.Verify existing direct-client and package-local proxy usage still works.
Separately test real transport integration and
.pyigeneration; record untested items explicitly.Update Japanese and English README/Pages documentation together.
Prohibited deviations
Adding a
register_backendtransport registry.Registering one device-class name separately per transport.
Giving the common
DeviceProxybuilt-in semantics forasync_modeorconfig.Claiming that
pip installalone automatically resolves device names.Replacing existing async/sync client classes with an invented unified class.
Implemented API
register_device_proxy(device_class, creator), DeviceProxy(device_class, *args, **kwargs), create_device_proxy(device_class), get_device_proxy_entry(device_class), list_device_proxies(), unregister_device_proxy(device_class), make_async_sync_factory(...).
This contract covers the current common-factory prototype. Migration of existing device packages and integration of type-stub generation remain undecided.