Skip to main content

Veyron plugin SDK for Python

Project description

veyron-sdk

Python SDK for writing Veyron plugins.

A Veyron plugin is a separate OS process supervised by the Veyron kernel. It talks to the kernel over a Unix domain socket using the Veyron wire protocol: framed messages carrying Protobuf envelopes, with optional zstd compression, HMAC-SHA256 frame authentication, and fragmentation.

Protocol source

proto/veyron_protocol.proto is vendored from veyron-wire's wire/proto/. It's copied by hand, not path-referenced — re-sync it when the protocol changes upstream, then regenerate veyron/veyron_protocol_pb2.py.

Install

pip install veyron-sdk

Quick start

import asyncio
import json

from veyron import Plugin
from veyron.veyron_protocol_pb2 import ActionResponse, ActionStatus, Envelope, PluginManifest


class EchoPlugin(Plugin):
    plugin_id = "echo-plugin"
    manifest = PluginManifest(actions=["echo"])

    async def on_message(self, envelope: Envelope) -> None:
        if envelope.WhichOneof("payload") != "action_request":
            return
        req = envelope.action_request
        resp = ActionResponse(
            action_id=req.action_id,
            status=ActionStatus.ACTION_OK,
            data_json=json.dumps({"echo": json.loads(req.params_json or b"{}")}).encode(),
        )
        out = Envelope(sender_id=self.plugin_id)
        out.action_response.CopyFrom(resp)
        await self._client.send("kernel", out)


if __name__ == "__main__":
    asyncio.run(EchoPlugin().run())

Plugin.run connects, registers, and serves until the kernel asks the plugin to shut down. The SDK answers Ping automatically and exits the loop on PluginShutdown. See examples/echo_plugin.py for a fuller example with event subscription.

Environment

Variable Meaning
VEYRON_SOCKET_PATH Kernel UDS path. Default: XDG_RUNTIME_DIR/run/user/<uid>~/.veyron/run (never shared /tmp).
VEYRON_JWT_TOKEN JWT presented at registration (required on secured kernels).
VEYRON_JWT_SECRET Shared secret; enables per-frame HMAC-SHA256 tags after registration.

Protocol coverage

The SDK's framing module implements the full Veyron wire format described in docs/FRAMING.md: HMAC-tagged frames, zstd decompression for payloads compressed by the kernel, and reassembly of fragmented messages.

Development

pip install -e ".[dev]"
pytest

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

veyron_sdk-0.1.0.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

veyron_sdk-0.1.0-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file veyron_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: veyron_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for veyron_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fab5cecad9b9e9f523d68d0a601dcdd01159abd33cb5d4235309740246d51e96
MD5 31e87533e561869cc6f77d28c4c69505
BLAKE2b-256 6d3e140f5cbc6422f0cc2869bdb3cf5bd9f4bf9e551d1744bea932baf3f6149e

See more details on using hashes here.

File details

Details for the file veyron_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: veyron_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for veyron_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e7840d8e039dd542130a61a0af2b22493538e8e971797a5558d9a507785d7442
MD5 fc338a999cef469a9e5d45710bd58c99
BLAKE2b-256 673b0cc36d6281e8dfe131c94413a8a439e937dd420762f57c9590afdd233b3c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page