Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Python client

PyPI

The Python client (pip install varta) is a first-class peer of the Rust varta-client crate. It tracks the same wire-format contract, passes the same tools/vlp-test-vectors.json conformance suite, and interoperates with the same varta-watch observer binary.

Install

pip install varta                # base client (stdlib only)
pip install 'varta[secure]'      # adds secure-UDP via `cryptography`

Requires Python 3.8+. Runs on Linux and macOS. The base install carries zero third-party dependencies; the secure extra pulls in cryptography for the ChaCha20-Poly1305 AEAD primitive.

20-line example

import time
from varta import Varta, Status, DropReason

with Varta.connect("/run/varta/varta.sock") as agent:
    while True:
        outcome = agent.beat(Status.OK)
        if outcome.is_dropped:
            # Four-way taxonomy mirrors the Rust client:
            assert outcome.reason in {
                DropReason.KERNEL_QUEUE_FULL,
                DropReason.NO_OBSERVER,
                DropReason.PEER_GONE,
                DropReason.STORAGE_FULL,
            }
        time.sleep(0.5)

For UDP and secure-UDP transports, fork-safety, the panic-hook family, and the full parity matrix see the package README in the repo: clients/python/README.md.

Transports

TransportStatusNotes
Unix Domain SocketsSupportedVarta.connect(path). Classified BeatOrigin::KernelAttested only on observer platforms with pathname-UDS peer credentials; macOS observers treat pathname UDS as socket-mode-only, so recovery is refused.
Plaintext UDPSupportedVarta.connect_udp((host, port)). Connected-mode socket. Beats classified NetworkUnverified; recovery refused.
Secure UDP (ChaCha20-Poly1305)SupportedVarta.connect_secure_udp((host, port), key). Requires pip install 'varta[secure]'.
Master-key secure UDPSupportedVarta.connect_secure_udp_with_master((host, port), mkey)

Stability

Source