Skip to main content

No project description provided

Project description

Eyegway


Intro

Eyegway is a python package for data routing through Redis / Dragonfly / KeyDB. It is designed to be a simple and easy to use package for sending any data from a generic source to a generic destination by exploting HUBs(and)SPOKES paradigm. The user can send data to a generic HUB, which has a data queue and a data history, and the data can be pulled from anywhere else.

The library needs a running instance of Redis / Dragonfly / KeyDB to work.

Installation

pip install -e .

Basic Usage

Create a Hub

In order to use the machinery, you need to create a Hub with a unique name which is used to identify the hub across the network:

import eyegway.hubs.asyn as eha
hub = eha.AsyncMessageHub.create(name='my_hub')

This method will create a new hub with the given name using default settings retrieved from environment variables.

How to override default settings?

Programmatically Override Settings

If you want to override the default settings, you can pass a configuration dictionary to the create method:

import eyegway.hubs as eh
config = eh.HubsConfig(max_buffer_size=1000)
hub = ehs.MessageHub.create(hub_name, config=config)

Override Environment Variables

Set the following environment variables before launching the application:

eyegway_hubs_redis_host="localhost"
eyegway_hubs_redis_port=6379
eyegway_hubs_max_buffer_size=10
eyegway_hubs_max_history_size=10

Send and Receive Data from/to the Hub

Then you can send data to the hub:

await hub.push({'counter':0})

From another process/node, you can pull the data from the hub:

import eyegway.hubs.asyn as eha
hub = eha.AsyncMessageHub.create(name='my_hub')
data = await hub.pop()
print(data)

The pop method will remove the data from the hub's queue. If you want to read the data without removing it, you can use the last method:

data = await hub.last(offset=0)
print(data)

Examples

You can find more examples (both for Async and Sync version of the hubs) in Hubs Examples

CLI Usage

Eyegway comes with a CLI tool to interact with the hubs. You can use the eyegway command to interact with the hubs.

eyegway hubs

For example:

eyegway hubs search # List all the hubs

eyegway hubs info -n $HUB_NAME # Get information about the hub

eyegway hubs last -n $HUB_NAME # Print the last data in the hub in a fancy way

eyegway hubs stream-demo -n $HUB_NAME # Stream demo data to the hub

API Rest Server

Eyegway comes with a REST API server to interact with the hubs. You can use the eyegway command to start the server.

eyegway hubs rest-serve

Then go to http://localhost:55221/docs to see the API documentation (where 55221is the default Eyegwat port, you can change it using the --port option).

WebUI

If the REST API server is running, you can run the battery-included WebUI to interact with the hubs. The webui is a Svelte package available in the relative websubfolder, see: Eyegway Svelte for more details.

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

eyecan_eyegway-0.6.3.tar.gz (21.5 kB view details)

Uploaded Source

Built Distribution

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

eyecan_eyegway-0.6.3-py3-none-any.whl (30.0 kB view details)

Uploaded Python 3

File details

Details for the file eyecan_eyegway-0.6.3.tar.gz.

File metadata

  • Download URL: eyecan_eyegway-0.6.3.tar.gz
  • Upload date:
  • Size: 21.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for eyecan_eyegway-0.6.3.tar.gz
Algorithm Hash digest
SHA256 c74a56932b58414f13dea2cca72e5844eadb2a86103baff852c7c57ded79a6e5
MD5 0f20f5c7be1d5fd25d417c8a5c83d061
BLAKE2b-256 477964cf58de3c0a87f753e9e6ff790fe583e1cdcbb88447005d8cf00fe5187a

See more details on using hashes here.

File details

Details for the file eyecan_eyegway-0.6.3-py3-none-any.whl.

File metadata

  • Download URL: eyecan_eyegway-0.6.3-py3-none-any.whl
  • Upload date:
  • Size: 30.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for eyecan_eyegway-0.6.3-py3-none-any.whl
Algorithm Hash digest
SHA256 71b0fa5730cd0b0e23c3f52b11cf2d6b5c3f8e3f580bc07d6055dcf8d8631bfe
MD5 c30eab350a8e7531167b7e3ed4b0c905
BLAKE2b-256 2f137ab0d3f60ed22b82592727b4228cbd2c0e401b0b48ced65000fe80a974de

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