pyremote
A simple and lightweight library for remote function calls
Usage
Here is the most intuitive example
server.py
import asyncio
from axirpc import NetworkServer, NetworkConnect
async def on_accept(conn: NetworkConnect):
say("accept")
await asyncio.sleep(1)
conn.disconnect()
server = NetworkServer(("127.0.0.1", 5566), on_accept)
@server.register_func
def say(msg: str):
print(msg)
async def main():
await server.run()
asyncio.run(main())
client.py
import asyncio
from axirpc import NetworkConnect
connect = NetworkConnect(("127.0.0.1", 5566))
@connect.register_func
def say(msg: str):
print(msg)
async def main():
await connect.run()
if __name__ == '__main__':
asyncio.run(main())
First run server.py, then run client.py, and "accept" will appear in the client's console before it stops
Adding Resources
Resources with consistent IDs can be added to both parties using the method above. These resources can then be directly passed as parameters during function calls.
server.py
async def on_accept(conn: NetworkConnect):
say(res)
await asyncio.sleep(1)
conn.disconnect()
server = NetworkServer(("127.0.0.1", 5566), on_accept)
res = object()
server.res_man.register(res, uuid.UUID("00000000-0000-0000-0000-000000000000"))
@server.register_func
def say(a):
print(a)
client.py
connect = NetworkConnect(("127.0.0.1", 5566))
res = object()
connect.res_man.register(res, uuid.UUID("00000000-0000-0000-0000-000000000000"))
@connect.register_func
def say(a):
print(a)
The running result will now be: <object object at 0x000001C5AD554F50>
Future Tasks
- Add object-oriented support
- More detailed README documentation...
- Add more extension options
- Add logging
Metadata
Release files for axi-rpc 0.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 |
|---|---|---|---|---|
| axi_rpc-0.1.0.tar.gz | 4.3 kB | Without provenance | Details for axi_rpc-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| axi_rpc-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for axi_rpc-0.1.0-py3-none-any.whl |
Total release size: 9.9 kB
Release files / axi_rpc-0.1.0.tar.gz
| Download URL | axi_rpc-0.1.0.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c24fb4d0682a3227b9707657822deba25984099009824ecd844e3581e0b48abd
|
|
BLAKE2b-256 checksum How to use checksums |
3081fc5aa4167f63df9c0f13d15d2c8e1995ce7732046844e63d3c7fd9ea07c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.0
|
Release files / axi_rpc-0.1.0-py3-none-any.whl
| Download URL | axi_rpc-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ad64981418dec96126fd8093a0214ad573ba27285047e39ff6108f30b76ed727
|
|
BLAKE2b-256 checksum How to use checksums |
4ccd65578d66633e9f7e065055d8353b4be9ecade0321c944776cde7c2b34355
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.0
|
Security for axi-rpc 0.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.