pydantic-rpc 0.4.1__py3-none-any.whl → 0.5.0__py3-none-any.whl
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/core.py +14 -9
- {pydantic_rpc-0.4.1.dist-info → pydantic_rpc-0.5.0.dist-info}/METADATA +5 -4
- pydantic_rpc-0.5.0.dist-info/RECORD +8 -0
- pydantic_rpc-0.5.0.dist-info/entry_points.txt +2 -0
- pydantic_rpc-0.4.1.dist-info/RECORD +0 -7
- {pydantic_rpc-0.4.1.dist-info → pydantic_rpc-0.5.0.dist-info}/WHEEL +0 -0
- {pydantic_rpc-0.4.1.dist-info → pydantic_rpc-0.5.0.dist-info}/licenses/LICENSE +0 -0
pydantic_rpc/core.py
CHANGED
|
@@ -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()
|
|
@@ -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 |
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
pydantic_rpc/__init__.py,sha256=oomSVGmh_zddQQaphQt1L2xSVh9dD1LVyaAq1cN1FW4,231
|
|
2
|
+
pydantic_rpc/core.py,sha256=7RPQEhqzzUIqm6IYLSsKYPIHV1_VV7UvCehPAAkUuJ4,48085
|
|
3
|
+
pydantic_rpc/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
pydantic_rpc-0.5.0.dist-info/METADATA,sha256=xBMHL0pmboi5BAkREyu-LtlhXJ_drfj3jOwUbOaHlKE,12060
|
|
5
|
+
pydantic_rpc-0.5.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
6
|
+
pydantic_rpc-0.5.0.dist-info/entry_points.txt,sha256=LeZJ6UN-fhjKrEGkcmsAAKuA-fIe7MpvzKMPSZfi0NE,56
|
|
7
|
+
pydantic_rpc-0.5.0.dist-info/licenses/LICENSE,sha256=Y6jkAm2VqPqoGIGQ-mEQCecNfteQ2LwdpYhC5XiH_cA,1069
|
|
8
|
+
pydantic_rpc-0.5.0.dist-info/RECORD,,
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
pydantic_rpc/__init__.py,sha256=oomSVGmh_zddQQaphQt1L2xSVh9dD1LVyaAq1cN1FW4,231
|
|
2
|
-
pydantic_rpc/core.py,sha256=e6zO5qx9vJvOZR8yiBVx41jnIGEg2d_uDHzp6WgkN70,47938
|
|
3
|
-
pydantic_rpc/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
pydantic_rpc-0.4.1.dist-info/METADATA,sha256=4EwQ-24LOPI8h0eNivTcN9aI9n0db80HWEzLi9QZBqI,12007
|
|
5
|
-
pydantic_rpc-0.4.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
6
|
-
pydantic_rpc-0.4.1.dist-info/licenses/LICENSE,sha256=Y6jkAm2VqPqoGIGQ-mEQCecNfteQ2LwdpYhC5XiH_cA,1069
|
|
7
|
-
pydantic_rpc-0.4.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|