Skip to main content

A high-performance Python client for real-time management of XTablesServer network tables, designed for robotics and complex data-driven systems.

Project description

XTablesClient

XTablesClient is a Python client library designed to interact with the XTables server, allowing you to send and receive messages, subscribe to updates, and manage communication through ZeroMQ (ZMQ) sockets. The client supports publishing, subscribing, and retrieving various data types (strings, integers, booleans, arrays, and more) to/from the server.

Features

  • Socket Communication: Uses ZeroMQ for push, request, and subscription communication with the XTables server.
  • Subscription Management: Allows subscribing to specific keys or to all updates.
  • Multiple Data Types: Supports sending and receiving a variety of data types, including strings, integers, booleans, arrays, and raw bytes.
  • mDNS Support: Automatically resolves the server's IP address using Zeroconf if the hostname is not provided.

Installation

To install XTablesClient, simply use pip:

pip install XTablesClient

Usage

Basic Example

from XTablesClient import XTablesClient

# Initialize the client
client = XTablesClient()

# Publish a string message
client.publish("some_key", b"Hello, XTables!")

# Subscribe to a key and handle incoming messages
def message_handler(message):
    print(f"Received message for key: {message.key} with value: {message.value}")

client.subscribe("some_key", message_handler)

# Retrieve data
data = client.getString("some_key")
print(data)

Available Methods

Publishing Data

  • publish(key: str, value: str): Publish a string value to the server.
  • putString(key: str, value: str): Put a string value in the XTable.
  • putInteger(key: str, value: int): Put an integer value.
  • putBoolean(key: str, value: bool): Put a boolean value.

Subscribing to Updates

  • subscribe(key: str, consumer: Callable): Subscribe to updates for a specific key.
  • subscribe_all(consumer: Callable): Subscribe to updates for all keys.

Retrieving Data

  • getString(key: str): Get a string value from the server.
  • getInteger(key: str): Get an integer value.
  • getBoolean(key: str): Get a boolean value.
  • getArray(key: str): Get an array of values.

Documentation

  • XTablesClient is built with simplicity in mind and uses ZeroMQ for efficient communication with the XTables server. It can be easily extended or modified for custom use cases.
  • The package uses Zeroconf to automatically discover the server in your network if the IP is not provided.

License

XTablesClient is licensed under the MIT License. See the LICENSE file for more details.

Project details


Release history Release notifications | RSS feed

This version

5.3.6

Download files

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

Source Distribution

xtablesclient-5.3.6.tar.gz (18.6 kB view details)

Uploaded Source

Built Distribution

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

XTablesClient-5.3.6-py3-none-any.whl (22.6 kB view details)

Uploaded Python 3

File details

Details for the file xtablesclient-5.3.6.tar.gz.

File metadata

  • Download URL: xtablesclient-5.3.6.tar.gz
  • Upload date:
  • Size: 18.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for xtablesclient-5.3.6.tar.gz
Algorithm Hash digest
SHA256 a5bea2e7b8ad9b479ec231d93f7b199f08b834a8a8cac483d91547d2b009f5c9
MD5 0ce9895873255184756fb788b311f44b
BLAKE2b-256 4e9c7c1b638bd43730ac0f5ad9e9edf1073ee7d9cfac98da1e42054735ae6e3e

See more details on using hashes here.

File details

Details for the file XTablesClient-5.3.6-py3-none-any.whl.

File metadata

  • Download URL: XTablesClient-5.3.6-py3-none-any.whl
  • Upload date:
  • Size: 22.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for XTablesClient-5.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 a26117a47e60e80f22421431d3c7bd156c8f690c56b68be5d6d309aca4509d45
MD5 fc2a484b3534b84c63f29267e06a2e0a
BLAKE2b-256 9e1ab6f64f50790eec39d4e6aa852b7e6430f780a9f1280c75b734ade90d7907

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