pydantic-rpc-cli
CLI tool for pydantic-rpc with built-in server runtime support.
Installation
pip install pydantic-rpc-cli
This will install:
pydantic-rpc(core library)hypercorn(ASGI server)gunicorn(WSGI server)uvloop(optional asyncio performance improvement)
Usage
Generate Protobuf Files
# Generate .proto file from a service class
pydantic-rpc generate myapp.services.UserService --output ./proto/
# Also compile to Python code
pydantic-rpc generate myapp.services.UserService --compile
Run Servers
gRPC Server (default)
# Start a gRPC server
pydantic-rpc serve myapp.services.UserService --port 50051
# The CLI automatically detects if your service has async methods
# and uses AsyncIOServer or Server accordingly
Connect RPC via ASGI (HTTP/2)
# Run with Hypercorn (built-in)
pydantic-rpc serve myapp.services.UserService --asgi --port 8000
# Service will be available at:
# http://localhost:8000/UserService/
Connect RPC via WSGI (HTTP/1.1)
# Run with Gunicorn (built-in)
pydantic-rpc serve myapp.services.UserService --wsgi --port 8000
# With multiple workers
pydantic-rpc serve myapp.services.UserService --wsgi --port 8000 --workers 4
# Service will be available at:
# http://localhost:8000/UserService/
Example Service
# myapp/services.py
from pydantic_rpc import Message, AsyncIOServer
class HelloRequest(Message):
name: str
class HelloResponse(Message):
message: str
class GreeterService:
async def say_hello(self, request: HelloRequest) -> HelloResponse:
return HelloResponse(message=f"Hello, {request.name}!")
Run it:
# As gRPC
pydantic-rpc serve myapp.services.GreeterService
# As Connect RPC (HTTP/2)
pydantic-rpc serve myapp.services.GreeterService --asgi --port 8000
# As Connect RPC (HTTP/1.1)
pydantic-rpc serve myapp.services.GreeterService --wsgi --port 8000
Benefits of the Separated CLI
- Lightweight Core: The main
pydantic-rpcpackage remains lightweight without server dependencies - Full Server Support: When you install
pydantic-rpc-cli, you get everything needed to run services - Flexibility: Choose between gRPC, ASGI (HTTP/2), or WSGI (HTTP/1.1) at runtime
License
Same as pydantic-rpc
Metadata
Release files for pydantic-rpc-cli 0.15.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 | Actions |
|---|---|---|---|---|
| pydantic_rpc_cli-0.15.2.tar.gz | 4.8 kB | Without provenance | Details for pydantic_rpc_cli-0.15.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pydantic_rpc_cli-0.15.2-py3-none-any.whl | Python 3 | none | any | Details for pydantic_rpc_cli-0.15.2-py3-none-any.whl |
Total release size: 11.0 kB
Release files / pydantic_rpc_cli-0.15.2.tar.gz
| Download URL | pydantic_rpc_cli-0.15.2.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fdd6f3999772299cd7685eb89d6336de017f16545d4ada4c457825ab89e032ca
|
|
BLAKE2b-256 checksum How to use checksums |
f552e7fc1cdc4039dae5a6510bbc86ceb066c53ee70f25a3da9abfe9c9201056
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / pydantic_rpc_cli-0.15.2-py3-none-any.whl
| Download URL | pydantic_rpc_cli-0.15.2-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
49e1824c33d27e62862774931423088219d7d4651529c42c926d6786bccf1265
|
|
BLAKE2b-256 checksum How to use checksums |
202fb8079e6f027f560287ef7838c7d99966b1a37782ec1c3766ab461bde99e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Security for pydantic-rpc-cli 0.15.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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.