pydantic-rpc 0.4.1__tar.gz → 0.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/PKG-INFO +5 -4
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/README.md +4 -3
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/pyproject.toml +4 -1
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/src/pydantic_rpc/core.py +14 -9
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/uv.lock +1 -1
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/.gitignore +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/.python-version +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/LICENSE +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/README.md +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/agent_aio_grpc.py +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/agent_connecpy.py +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/asyncio_greeting.py +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/barservice.proto +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/barservice_pb2.py +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/barservice_pb2.pyi +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/barservice_pb2_grpc.py +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/foobar.py +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/foobar_client.py +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/fooservice.proto +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/fooservice_pb2.py +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/fooservice_pb2.pyi +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/fooservice_pb2_grpc.py +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/google/protobuf/duration.proto +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/google/protobuf/timestamp.proto +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/greeter.proto +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/greeter_client.py +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/greeter_connecpy.py +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/greeter_connecpy_client.py +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/greeter_pb2.py +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/greeter_pb2.pyi +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/greeter_pb2_grpc.py +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/greeter_sonora_client.py +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/greeting.py +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/greeting_asgi.py +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/greeting_connecpy.py +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/greeting_using_exsiting_pb2_modules.py +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/greeting_wsgi.py +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/olympicsagent.proto +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/olympicsagent_pb2.py +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/olympicsagent_pb2.pyi +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/olympicsagent_pb2_grpc.py +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/olympicslocationagent.proto +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/olympicslocationagent_connecpy.py +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/olympicslocationagent_pb2.py +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/olympicslocationagent_pb2.pyi +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/olympicslocationagent_pb2_grpc.py +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/src/pydantic_rpc/__init__.py +0 -0
- {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/src/pydantic_rpc/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pydantic-rpc
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: A Python library for building gRPC/ConnectRPC services with Pydantic models.
|
|
5
5
|
Author: Yasushi Itoh
|
|
6
6
|
License-File: LICENSE
|
|
@@ -404,16 +404,17 @@ if __name__ == "__main__":
|
|
|
404
404
|
|
|
405
405
|
TODO
|
|
406
406
|
|
|
407
|
-
### 🗄️ Protobuf file generation
|
|
407
|
+
### 🗄️ Protobuf file and code (Python files) generation
|
|
408
408
|
|
|
409
|
-
|
|
409
|
+
Youcan genereate protobuf files and code for a given module and a specified class using `pydantic-rpc` CLI command:
|
|
410
410
|
|
|
411
411
|
```bash
|
|
412
|
-
|
|
412
|
+
pydantic-rpc a_module.py aClassName
|
|
413
413
|
```
|
|
414
414
|
|
|
415
415
|
Using this generated proto file and tools as `protoc`, `buf` and `BSR`, you could generate code for any desired language other than Python.
|
|
416
416
|
|
|
417
|
+
|
|
417
418
|
## 📖 Data Type Mapping
|
|
418
419
|
|
|
419
420
|
| Python Type | Protobuf Type |
|
|
@@ -389,16 +389,17 @@ if __name__ == "__main__":
|
|
|
389
389
|
|
|
390
390
|
TODO
|
|
391
391
|
|
|
392
|
-
### 🗄️ Protobuf file generation
|
|
392
|
+
### 🗄️ Protobuf file and code (Python files) generation
|
|
393
393
|
|
|
394
|
-
|
|
394
|
+
Youcan genereate protobuf files and code for a given module and a specified class using `pydantic-rpc` CLI command:
|
|
395
395
|
|
|
396
396
|
```bash
|
|
397
|
-
|
|
397
|
+
pydantic-rpc a_module.py aClassName
|
|
398
398
|
```
|
|
399
399
|
|
|
400
400
|
Using this generated proto file and tools as `protoc`, `buf` and `BSR`, you could generate code for any desired language other than Python.
|
|
401
401
|
|
|
402
|
+
|
|
402
403
|
## 📖 Data Type Mapping
|
|
403
404
|
|
|
404
405
|
| Python Type | Protobuf Type |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "pydantic-rpc"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.5.0"
|
|
4
4
|
description = "A Python library for building gRPC/ConnectRPC services with Pydantic models."
|
|
5
5
|
authors = [
|
|
6
6
|
{ name = "Yasushi Itoh" }
|
|
@@ -16,6 +16,9 @@ dependencies = [
|
|
|
16
16
|
readme = "README.md"
|
|
17
17
|
requires-python = ">= 3.11"
|
|
18
18
|
|
|
19
|
+
[project.scripts]
|
|
20
|
+
pydantic-rpc = "pydantic_rpc.core:main"
|
|
21
|
+
|
|
19
22
|
[build-system]
|
|
20
23
|
requires = ["hatchling"]
|
|
21
24
|
build-backend = "hatchling.build"
|
|
@@ -1330,14 +1330,19 @@ class ConnecpyASGIApp:
|
|
|
1330
1330
|
await self._app(scope, receive, send)
|
|
1331
1331
|
|
|
1332
1332
|
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
"""
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1333
|
+
def main():
|
|
1334
|
+
import argparse
|
|
1335
|
+
|
|
1336
|
+
parser = argparse.ArgumentParser(description="Generate and compile proto files.")
|
|
1337
|
+
parser.add_argument("py_file", type=str, help="The Python file containing the service class.")
|
|
1338
|
+
parser.add_argument("class_name", type=str, help="The name of the service class.")
|
|
1339
|
+
args = parser.parse_args()
|
|
1340
|
+
|
|
1341
|
+
module_name = os.path.splitext(basename(args.py_file))[0]
|
|
1341
1342
|
module = importlib.import_module(module_name)
|
|
1342
|
-
klass = getattr(module, class_name)
|
|
1343
|
+
klass = getattr(module, args.class_name)
|
|
1343
1344
|
generate_and_compile_proto(klass())
|
|
1345
|
+
|
|
1346
|
+
|
|
1347
|
+
if __name__ == "__main__":
|
|
1348
|
+
main()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|