Observed since 20 Oct, 20:55 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
aetherrpc
A zero-dependency RPC framework for Python
A lightweight, zero-dependency RPC framework for Python.
AetherRPC lets Python applications communicate with each other over TCP using a simple remote-procedure-call interface.
It supports synchronous and asynchronous RPC calls, streaming, authentication, concurrent calls, custom Python objects, remote exception propagation, middleware, and dynamic client proxies.
Install from PyPI:
pip install aetherrpc
from aetherrpc import AetherRPCServer
server = AetherRPCServer(
host="127.0.0.1",
port=9000,
)
@server.register
def add(a, b):
return a + b
server.start()
The function registered with @server.register becomes available to RPC clients.
from aetherrpc import AetherRPCClient
client = AetherRPCClient(
host="127.0.0.1",
port=9000,
)
client.connect()
result = client.add(2, 3)
print(result) # 5
client.close()
The client dynamically resolves public method names, so there is no need to manually create a proxy for every registered server method.
Clients can also be used as context managers:
from aetherrpc import AetherRPCClient
client = AetherRPCClient(
host="127.0.0.1",
port=9000,
)
with client as rpc:
print(rpc.add(2, 3))
Enable token authentication on the server:
from aetherrpc import AetherRPCServer
server = AetherRPCServer(
host="127.0.0.1",
port=9000,
auth_token="my-secret-token",
)
@server.register
def add(a, b):
return a + b
server.start()
Then provide the same token to the client:
from aetherrpc import AetherRPCClient
client = AetherRPCClient(
host="127.0.0.1",
port=9000,
auth_token="my-secret-token",
)
with client as rpc:
print(rpc.add(10, 20))
Clients with an invalid or missing token are rejected when authentication is enabled.
AetherRPC supports asynchronous client calls:
import asyncio
from aetherrpc import AetherRPCClient
async def main():
client = AetherRPCClient(
host="127.0.0.1",
port=9000,
)
client.connect()
result = await client.async_add(2, 3)
print(result)
client.close()
asyncio.run(main())
Async server functions are supported as well:
@server.register
async def add(a, b):
return a + b
Server methods can be registered with an alias:
@server.register(alias="sum")
def add_numbers(a, b):
return a + b
Clients can then call:
result = client.sum(2, 3)
AetherRPC supports streaming RPC operations for both synchronous and asynchronous handlers.
This makes it possible to send results progressively instead of waiting for a single final value.
See the test suite for streaming examples.
Exceptions raised by remote procedures can be propagated back to the client as AetherRPC errors.
For example:
@server.register
def divide(a, b):
return a / b
A failed remote call can then be handled normally by the client:
try:
result = client.divide(10, 0)
except Exception as exc:
print(f"RPC failed: {exc}")
AetherRPC also provides its own exception hierarchy for connection, timeout, streaming, and RPC-related failures.
The client supports configuration such as:
client = AetherRPCClient(
host="127.0.0.1",
port=9000,
auth_token=None,
connect_timeout=5,
)
The default client configuration uses:
Host: 127.0.0.1
Port: 9000
Authentication: disabled
AetherRPC provides an aetherrpc command through its Python package entry point for demo.
aetherrpc {server|client}
AetherRPC uses Python's built-in unittest framework.
Run the complete test suite with:
python -m unittest discover -s tests -v
The project currently includes tests covering:
aetherrpc/
├── src/
│ └── aetherrpc/
│ ├── client.py
│ ├── protocol.py
│ ├── server.py
│ ├── __init__.py
│ └── __main__.py
│
├── tests/
│ ├── test_client.py
│ ├── test_integration.py
│ ├── test_protocol.py
│ ├── test_server.py
│ └── __init__.py
│
├── LICENSE
├── README.md
└── pyproject.toml
AetherRPC is released under the MIT License.
See LICENSE for the full license text.
AetherRPC is currently at version 0.1.0.
The API may evolve as the project develops.
Download counts and popularity will appear here as the collector receives them.
Declarations describe requirements; they are not a resolved dependency graph.
bdist_wheel · 22.62 KB · Python py3
sdist · 25.39 KB · Python source
Observed since 20 Oct, 20:55 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:442a8abe67409a7a6f64e4a69d6b3f8d8ee4dd4c2aaec8c4303e660805c8f599