Zonis
A coro based callback system for many to one IPC setups.
pip install zonis
Simplistic example
Client:
import asyncio
from zonis import Client
async def main():
client = Client(url="localhost:12344/ws")
@client.route()
async def ping():
print("Pong'd!")
return "pong"
await client.start()
await client.block_until_closed()
asyncio.run(main())
Server:
import asyncio
import json
from fastapi import FastAPI
from starlette.websockets import WebSocket, WebSocketDisconnect
from zonis import UnknownClient
from zonis.server import Server
app = FastAPI()
server = Server(using_fastapi_websockets=True)
@app.get("/")
async def index():
try:
response = await server.request("ping")
return {"data": response} # Returns pong
except UnknownClient as e:
return e
@app.websocket("/ws")
async def websocket_endpoint(websocket: WebSocket):
await websocket.accept()
d: str = await websocket.receive_text()
identifier = await server.parse_identify(json.loads(d), websocket)
try:
await asyncio.Future()
except WebSocketDisconnect:
await server.disconnect(identifier)
print(f"Closed connection for {identifier}")
See the examples directory for more use cases.
For documentation, please see here.
Support
Want realtime help? Join the discord here.
Funding
Want a feature added quickly? Want me to help build your software using this?
Sponsor me here
Metadata
Release files for zonis 2.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| zonis-2.1.0.tar.gz | 11.5 kB | Without provenance | Details for zonis-2.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| zonis-2.1.0-py3-none-any.whl | Python 3 | none | any | Details for zonis-2.1.0-py3-none-any.whl |
Total release size: 25.7 kB
Release files / zonis-2.1.0.tar.gz
| Download URL | zonis-2.1.0.tar.gz |
|---|---|
| Size | 11.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aea29117ab4b3772c59fa6a0a9b2dfff5e3711485ea3b26974eb73831f0460c0
|
|
BLAKE2b-256 checksum How to use checksums |
8727eb91834388a4d783c0d6af63bfd47d102160614270790a4ed1acc20ac3f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.10.12 Linux/6.5.0-35-generic
|
Release files / zonis-2.1.0-py3-none-any.whl
| Download URL | zonis-2.1.0-py3-none-any.whl |
|---|---|
| Size | 14.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
08e7750dc1da9ca6e69a14a74388d0e4df427cd6aeb0f899f104ea1eed214c11
|
|
BLAKE2b-256 checksum How to use checksums |
a1f332cbb95a35f7b37064da5b8e2eba6160527c210803d30224100a6939e8f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.10.12 Linux/6.5.0-35-generic
|
Security for zonis 2.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.