pydantic-rpc 0.15.0__py3-none-any.whl → 0.15.2__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
CHANGED
|
@@ -565,8 +565,6 @@ def connect_obj_with_stub(
|
|
|
565
565
|
|
|
566
566
|
# Attach all RPC methods from service_obj to the concrete servicer
|
|
567
567
|
for method_name, method in get_rpc_methods(service_obj):
|
|
568
|
-
if method_name.startswith("_"):
|
|
569
|
-
continue
|
|
570
568
|
setattr(ConcreteServiceClass, method_name, implement_stub_method(method))
|
|
571
569
|
|
|
572
570
|
return ConcreteServiceClass
|
|
@@ -1064,7 +1062,9 @@ def connect_obj_with_stub_async_connect_python(
|
|
|
1064
1062
|
e, method, context, None, is_grpc=False
|
|
1065
1063
|
)
|
|
1066
1064
|
except Exception as e:
|
|
1067
|
-
raise ConnectError(
|
|
1065
|
+
raise ConnectError(
|
|
1066
|
+
code=Errors.INTERNAL, message=str(e)
|
|
1067
|
+
)
|
|
1068
1068
|
else: # size_of_parameters == 2
|
|
1069
1069
|
|
|
1070
1070
|
async def stub_method(
|
|
@@ -1084,7 +1084,9 @@ def connect_obj_with_stub_async_connect_python(
|
|
|
1084
1084
|
e, method, context, None, is_grpc=False
|
|
1085
1085
|
)
|
|
1086
1086
|
except Exception as e:
|
|
1087
|
-
raise ConnectError(
|
|
1087
|
+
raise ConnectError(
|
|
1088
|
+
code=Errors.INTERNAL, message=str(e)
|
|
1089
|
+
)
|
|
1088
1090
|
|
|
1089
1091
|
return stub_method
|
|
1090
1092
|
else:
|
|
@@ -1110,7 +1112,9 @@ def connect_obj_with_stub_async_connect_python(
|
|
|
1110
1112
|
e, method, context, None, is_grpc=False
|
|
1111
1113
|
)
|
|
1112
1114
|
except Exception as e:
|
|
1113
|
-
raise ConnectError(
|
|
1115
|
+
raise ConnectError(
|
|
1116
|
+
code=Errors.INTERNAL, message=str(e)
|
|
1117
|
+
)
|
|
1114
1118
|
else: # size_of_parameters == 2
|
|
1115
1119
|
|
|
1116
1120
|
async def stub_method(
|
|
@@ -1132,7 +1136,9 @@ def connect_obj_with_stub_async_connect_python(
|
|
|
1132
1136
|
e, method, context, None, is_grpc=False
|
|
1133
1137
|
)
|
|
1134
1138
|
except Exception as e:
|
|
1135
|
-
raise ConnectError(
|
|
1139
|
+
raise ConnectError(
|
|
1140
|
+
code=Errors.INTERNAL, message=str(e)
|
|
1141
|
+
)
|
|
1136
1142
|
|
|
1137
1143
|
return stub_method
|
|
1138
1144
|
else:
|
|
@@ -1165,7 +1171,9 @@ def connect_obj_with_stub_async_connect_python(
|
|
|
1165
1171
|
e, method, context, request, is_grpc=False
|
|
1166
1172
|
)
|
|
1167
1173
|
except Exception as e:
|
|
1168
|
-
raise ConnectError(
|
|
1174
|
+
raise ConnectError(
|
|
1175
|
+
code=Errors.INTERNAL, message=str(e)
|
|
1176
|
+
)
|
|
1169
1177
|
else: # size_of_parameters == 2
|
|
1170
1178
|
|
|
1171
1179
|
async def stub_method(
|
|
@@ -1188,7 +1196,9 @@ def connect_obj_with_stub_async_connect_python(
|
|
|
1188
1196
|
e, method, context, request, is_grpc=False
|
|
1189
1197
|
)
|
|
1190
1198
|
except Exception as e:
|
|
1191
|
-
raise ConnectError(
|
|
1199
|
+
raise ConnectError(
|
|
1200
|
+
code=Errors.INTERNAL, message=str(e)
|
|
1201
|
+
)
|
|
1192
1202
|
|
|
1193
1203
|
return stub_method
|
|
1194
1204
|
else:
|
|
@@ -1219,7 +1229,9 @@ def connect_obj_with_stub_async_connect_python(
|
|
|
1219
1229
|
e, method, context, request, is_grpc=False
|
|
1220
1230
|
)
|
|
1221
1231
|
except Exception as e:
|
|
1222
|
-
raise ConnectError(
|
|
1232
|
+
raise ConnectError(
|
|
1233
|
+
code=Errors.INTERNAL, message=str(e)
|
|
1234
|
+
)
|
|
1223
1235
|
else: # size_of_parameters == 2
|
|
1224
1236
|
|
|
1225
1237
|
async def stub_method(
|
|
@@ -1246,7 +1258,9 @@ def connect_obj_with_stub_async_connect_python(
|
|
|
1246
1258
|
e, method, context, request, is_grpc=False
|
|
1247
1259
|
)
|
|
1248
1260
|
except Exception as e:
|
|
1249
|
-
raise ConnectError(
|
|
1261
|
+
raise ConnectError(
|
|
1262
|
+
code=Errors.INTERNAL, message=str(e)
|
|
1263
|
+
)
|
|
1250
1264
|
|
|
1251
1265
|
return stub_method
|
|
1252
1266
|
|
|
@@ -2310,7 +2324,7 @@ def get_rpc_methods(obj: object) -> list[tuple[str, Callable[..., Any]]]:
|
|
|
2310
2324
|
return [
|
|
2311
2325
|
(to_pascal_case(attr_name), getattr(obj, attr_name))
|
|
2312
2326
|
for attr_name in dir(obj)
|
|
2313
|
-
if inspect.ismethod(getattr(obj, attr_name))
|
|
2327
|
+
if inspect.ismethod(getattr(obj, attr_name)) and not attr_name.startswith('_')
|
|
2314
2328
|
]
|
|
2315
2329
|
|
|
2316
2330
|
|
|
@@ -2956,12 +2970,13 @@ class AsyncIOServer:
|
|
|
2956
2970
|
await self._server.start()
|
|
2957
2971
|
|
|
2958
2972
|
shutdown_event = asyncio.Event()
|
|
2973
|
+
loop = asyncio.get_running_loop()
|
|
2959
2974
|
|
|
2960
2975
|
def shutdown(signum: signal.Signals, frame: Any):
|
|
2961
2976
|
_ = signum
|
|
2962
2977
|
_ = frame
|
|
2963
2978
|
print("Received shutdown signal...")
|
|
2964
|
-
shutdown_event.set
|
|
2979
|
+
loop.call_soon_threadsafe(shutdown_event.set)
|
|
2965
2980
|
|
|
2966
2981
|
for s in [signal.SIGTERM, signal.SIGINT]:
|
|
2967
2982
|
_ = signal.signal(s, shutdown) # pyright:ignore[reportArgumentType]
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: pydantic-rpc
|
|
3
|
-
Version: 0.15.
|
|
3
|
+
Version: 0.15.2
|
|
4
4
|
Summary: A Python library for building gRPC/ConnectRPC services with Pydantic models.
|
|
5
5
|
Author: Yasushi Itoh
|
|
6
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
7
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
6
10
|
Requires-Dist: annotated-types==0.7.0
|
|
7
11
|
Requires-Dist: pydantic>=2.1.1
|
|
8
12
|
Requires-Dist: grpcio>=1.56.2
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
pydantic_rpc/__init__.py,sha256=1b57454e64c68891868ea3993af9e11100c579b56af99f4aa0f836934ddf883d,925
|
|
2
|
-
pydantic_rpc/core.py,sha256=
|
|
2
|
+
pydantic_rpc/core.py,sha256=6f76ac5331e3fb081a92aade959cdb9c9cd5252d1e0b2879e20bef920b3f398a,121869
|
|
3
3
|
pydantic_rpc/decorators.py,sha256=3ee29ded407c888793694452f0b32fbcf46aedd09b42275a2eedaffda9e0e5f4,7465
|
|
4
4
|
pydantic_rpc/mcp/__init__.py,sha256=f05ad62cc38db5c5972e16870c484523c58c5ac650d8454706f1ce4539cc7a52,123
|
|
5
5
|
pydantic_rpc/mcp/converter.py,sha256=b60dcaf82e6bff6be4b2ab8b1e9f2d16e09cb98d8f00182a4f6f73d1a78848a4,4158
|
|
@@ -7,6 +7,6 @@ pydantic_rpc/mcp/exporter.py,sha256=20833662f9a973ed9e1a705b9b59aaa2533de6c514eb
|
|
|
7
7
|
pydantic_rpc/options.py,sha256=6094036184a500b92715fd91d31ecc501460a56de47dcf6024c6335ae8e5d6e3,4561
|
|
8
8
|
pydantic_rpc/py.typed,sha256=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855,0
|
|
9
9
|
pydantic_rpc/tls.py,sha256=0eb290cc09c8ebedc71e7a97c01736d9675a314f70ebd80a2ce73e3f1689d359,3567
|
|
10
|
-
pydantic_rpc-0.15.
|
|
11
|
-
pydantic_rpc-0.15.
|
|
12
|
-
pydantic_rpc-0.15.
|
|
10
|
+
pydantic_rpc-0.15.2.dist-info/WHEEL,sha256=ab6157bc637547491fb4567cd7ddf26b04d63382916ca16c29a5c8e94c9c9ef7,79
|
|
11
|
+
pydantic_rpc-0.15.2.dist-info/METADATA,sha256=93fdff0d2d158857fc4407f578091366403faf6b3b740a95031d7b359f32e12f,36161
|
|
12
|
+
pydantic_rpc-0.15.2.dist-info/RECORD,,
|
|
File without changes
|