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.
Metadata
Release files for eyecan-eyegway 0.6.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| eyecan_eyegway-0.6.7.tar.gz | 21.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| eyecan_eyegway-0.6.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 51.9 kB
Release files / eyecan_eyegway-0.6.7.tar.gz
| Download URL | eyecan_eyegway-0.6.7.tar.gz |
|---|---|
| Size | 21.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bf050b2802f68455e6960732828f44907c65679127ef04d4e87a9146408f687c
|
|
BLAKE2b-256 checksum How to use checksums |
e750b8be50ca57e131eec3160346d42905bfecd30f2bca9c8af179b120d3d198
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / eyecan_eyegway-0.6.7-py3-none-any.whl
| Download URL | eyecan_eyegway-0.6.7-py3-none-any.whl |
|---|---|
| Size | 30.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9f1a47db9fc3b174bdd57428c14fac87b590aae08adf0a586cf65617935bf625
|
|
BLAKE2b-256 checksum How to use checksums |
868306b917088c6552c7a96adb419e6961d8f78173b105077232b5b563ec6345
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|