prpc-python - Pyodide Remote Procedure Calls - Python Server
Provides server-side bindings for prpc API.
To expose a python function as a prpc method you first create
a prpc RpcApp and then decorate your function with @app.call.
Create a file called myapp.py and add the following code:
# myapp.py
from prpc_python import RpcApp
app = RpcApp("My Hello World App")
@app.call
def hello():
return "World"
Discovering your API
You can now discover your API using the prpc command line tool. To do this
you either have to specify the plugin ID of your app or "publish" the
plugin using the Python plugin discovery approach.
The ID of your plugin is the name of the module containing
your RpcApp instance plus the name of the instance, e.g.
myapp:app for the example above.
You can now use the command line tool to discover your API:
prpc commands -a myapp:app
and you can even call your function from the command line:
prpc run -a myapp:app hello
Publishing
You don't always want to have to specify the plugin ID of your app. You can
use the approach described in the metadata section of the packaging
spec to publish your plugin. If you have a pyproject.toml file, then add
the following section:
[tool.poetry.plugins."prpc_python"]
myapp = "myapp:app"
If your plugin is the only one in your installed dependencies, then it will
be automatically chosen, and you can omit the -a myapp:app argument.
Files
prpc also supports file transfers. If you receive a file from the remote
endpoint, you will receive a prpc_python.RemoteFile object. This object
has a standard read method, so you can use it as a file-like object.
It may also have filename, size and content_type attributes but it
depends on the source of the file whether these are available.
Metadata
Release files for prpc-python 0.9.2
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 | |
|---|---|---|---|---|
| prpc_python-0.9.2.tar.gz | 8.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| prpc_python-0.9.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.2 kB
Release files / prpc_python-0.9.2.tar.gz
| Download URL | prpc_python-0.9.2.tar.gz |
|---|---|
| Size | 8.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b8e92d8750523a1a83f72920eccabf02504cff670fe74f52955724b72304f061
|
|
BLAKE2b-256 checksum How to use checksums |
555f29b9c4fea37aa2bcd7a6538fbac1f4d598056e6c1b40e5d246c1bb92241d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.2 CPython/3.8.12 Darwin/21.6.0
|
Release files / prpc_python-0.9.2-py3-none-any.whl
| Download URL | prpc_python-0.9.2-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1c51f97f753f2ad47de6894809f3bfd937a9051725196541e5d558a137c710e0
|
|
BLAKE2b-256 checksum How to use checksums |
a42a516fcd05a171659b7199af668310bbfd5926cea9a5f701ee677dd1d85749
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.2 CPython/3.8.12 Darwin/21.6.0
|
Security for prpc-python 0.9.2
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.