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.
Files changed (48) hide show
  1. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/PKG-INFO +5 -4
  2. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/README.md +4 -3
  3. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/pyproject.toml +4 -1
  4. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/src/pydantic_rpc/core.py +14 -9
  5. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/uv.lock +1 -1
  6. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/.gitignore +0 -0
  7. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/.python-version +0 -0
  8. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/LICENSE +0 -0
  9. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/README.md +0 -0
  10. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/agent_aio_grpc.py +0 -0
  11. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/agent_connecpy.py +0 -0
  12. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/asyncio_greeting.py +0 -0
  13. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/barservice.proto +0 -0
  14. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/barservice_pb2.py +0 -0
  15. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/barservice_pb2.pyi +0 -0
  16. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/barservice_pb2_grpc.py +0 -0
  17. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/foobar.py +0 -0
  18. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/foobar_client.py +0 -0
  19. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/fooservice.proto +0 -0
  20. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/fooservice_pb2.py +0 -0
  21. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/fooservice_pb2.pyi +0 -0
  22. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/fooservice_pb2_grpc.py +0 -0
  23. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/google/protobuf/duration.proto +0 -0
  24. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/google/protobuf/timestamp.proto +0 -0
  25. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/greeter.proto +0 -0
  26. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/greeter_client.py +0 -0
  27. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/greeter_connecpy.py +0 -0
  28. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/greeter_connecpy_client.py +0 -0
  29. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/greeter_pb2.py +0 -0
  30. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/greeter_pb2.pyi +0 -0
  31. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/greeter_pb2_grpc.py +0 -0
  32. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/greeter_sonora_client.py +0 -0
  33. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/greeting.py +0 -0
  34. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/greeting_asgi.py +0 -0
  35. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/greeting_connecpy.py +0 -0
  36. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/greeting_using_exsiting_pb2_modules.py +0 -0
  37. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/greeting_wsgi.py +0 -0
  38. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/olympicsagent.proto +0 -0
  39. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/olympicsagent_pb2.py +0 -0
  40. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/olympicsagent_pb2.pyi +0 -0
  41. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/olympicsagent_pb2_grpc.py +0 -0
  42. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/olympicslocationagent.proto +0 -0
  43. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/olympicslocationagent_connecpy.py +0 -0
  44. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/olympicslocationagent_pb2.py +0 -0
  45. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/olympicslocationagent_pb2.pyi +0 -0
  46. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/examples/olympicslocationagent_pb2_grpc.py +0 -0
  47. {pydantic_rpc-0.4.1 → pydantic_rpc-0.5.0}/src/pydantic_rpc/__init__.py +0 -0
  48. {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.4.1
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
- You can generate protobuf files for a given module and a specified class using `core.py`:
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
- python core.py a_module.py aClass
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
- You can generate protobuf files for a given module and a specified class using `core.py`:
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
- python core.py a_module.py aClass
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.4.1"
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
- if __name__ == "__main__":
1334
- """
1335
- If executed as a script, generate the .proto files for a given class.
1336
- Usage: python core.py some_module.py SomeServiceClass
1337
- """
1338
- py_file_name = sys.argv[1]
1339
- class_name = sys.argv[2]
1340
- module_name = os.path.splitext(basename(py_file_name))[0]
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()
@@ -1162,7 +1162,7 @@ wheels = [
1162
1162
 
1163
1163
  [[package]]
1164
1164
  name = "pydantic-rpc"
1165
- version = "0.4.0"
1165
+ version = "0.5.0"
1166
1166
  source = { editable = "." }
1167
1167
  dependencies = [
1168
1168
  { name = "connecpy" },
File without changes
File without changes