Skip to main content

Module source

Module source 

Source
Expand description

Python-defined dynamic Source support.

Lets Python code implement a PVAccess source — the same abstraction used internally by the built-in store — so Python users can publish arbitrary PV names computed on the fly, proxy other systems, add access control, and so on.

§Python API

A source is any Python object that implements the duck-typed methods below. All methods may be either plain functions or async def coroutines — the adapter detects awaitables automatically.

class MySource:
    def claim(self, name): ...      # -> PvInfo | dict | None
    def get(self, name): ...        # -> NtScalar | ... | None
    def put(self, name, value): ... # -> dict[str, NtPayload] | list | None
    def names(self): ...            # -> Iterable[str]
    def rpc(self, name, args): ...  # optional -> NtPayload
    def subscribe(self, name): ...  # optional (ignored; use notifier)
    def on_start(self, notifier): ...# optional: receive PyNotifier

Register via ServerBuilder.add_source(label, order, source) before build, or Server.add_source(label, order, source) after build.

Structs§

PyNotifier
Handle for publishing monitor updates to subscribed PVAccess clients.
PyPvInfo
Describes a PV claimed by a Python source. Returned from claim().
PySourceAdapter

Functions§

register