pydantic-rpc 0.12.0__tar.gz → 0.13.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pydantic-rpc
3
- Version: 0.12.0
3
+ Version: 0.13.0
4
4
  Summary: A Python library for building gRPC/ConnectRPC services with Pydantic models.
5
5
  Author: Yasushi Itoh
6
6
  Requires-Dist: annotated-types==0.7.0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pydantic-rpc"
3
- version = "0.12.0"
3
+ version = "0.13.0"
4
4
  description = "A Python library for building gRPC/ConnectRPC services with Pydantic models."
5
5
  authors = [
6
6
  { name = "Yasushi Itoh" }
@@ -33,6 +33,7 @@ dev-dependencies = [
33
33
  "pytest>=8.3.4",
34
34
  "pytest-asyncio>=0.20.3",
35
35
  "ruff>=0.9.4",
36
+ "uvicorn>=0.34.0",
36
37
  ]
37
38
 
38
39
  [tool.pytest.ini_options]
@@ -1,6 +1,9 @@
1
+ import annotated_types
1
2
  import asyncio
2
3
  import datetime
3
4
  import enum
5
+ import grpc
6
+ import grpc_tools
4
7
  import importlib.util
5
8
  import inspect
6
9
  import os
@@ -8,11 +11,19 @@ import signal
8
11
  import sys
9
12
  import time
10
13
  import types
11
- from typing import Union
12
14
  from collections.abc import AsyncIterator, Awaitable, Callable, Iterable
13
15
  from concurrent import futures
16
+ from connectrpc.code import Code as Errors
17
+ # Protobuf Python modules for Timestamp, Duration (requires protobuf / grpcio)
18
+ from google.protobuf import duration_pb2, timestamp_pb2, empty_pb2
19
+ from grpc import ServicerContext
20
+ from grpc_health.v1 import health_pb2, health_pb2_grpc
21
+ from grpc_health.v1.health import HealthServicer
22
+ from grpc_reflection.v1alpha import reflection
23
+ from grpc_tools import protoc
14
24
  from pathlib import Path
15
25
  from posixpath import basename
26
+ from pydantic import BaseModel, ValidationError
16
27
  from typing import (
17
28
  Any,
18
29
  Optional,
@@ -22,20 +33,10 @@ from typing import (
22
33
  cast,
23
34
  TypeGuard,
24
35
  )
36
+ from typing import Union
37
+ from typing import Union, Sequence, Tuple
38
+ from concurrent.futures import Executor
25
39
 
26
- import annotated_types
27
- import grpc
28
- from grpc import ServicerContext
29
- import grpc_tools
30
- from connectrpc.code import Code as Errors
31
-
32
- # Protobuf Python modules for Timestamp, Duration (requires protobuf / grpcio)
33
- from google.protobuf import duration_pb2, timestamp_pb2, empty_pb2
34
- from grpc_health.v1 import health_pb2, health_pb2_grpc
35
- from grpc_health.v1.health import HealthServicer
36
- from grpc_reflection.v1alpha import reflection
37
- from grpc_tools import protoc
38
- from pydantic import BaseModel, ValidationError
39
40
  from .decorators import get_method_options, has_http_option
40
41
  from .tls import GrpcTLSConfig
41
42
 
@@ -2711,10 +2712,22 @@ class AsyncIOServer:
2711
2712
  service: Optional[object] = None,
2712
2713
  port: int = 50051,
2713
2714
  package_name: str = "",
2714
- *interceptors: grpc.ServerInterceptor,
2715
2715
  tls: Optional["GrpcTLSConfig"] = None,
2716
+ interceptors: Optional[Sequence[grpc.ServerInterceptor]] = None,
2717
+ migration_thread_pool: Optional[Executor] = None,
2718
+ handlers: Optional[Sequence[grpc.GenericRpcHandler]] = None,
2719
+ options: Optional[Sequence[Tuple[str, Any]]] = None,
2720
+ maximum_concurrent_rpcs: Optional[int] = None,
2721
+ compression: Optional[grpc.Compression] = None,
2716
2722
  ) -> None:
2717
- self._server: grpc.aio.Server = grpc.aio.server(interceptors=interceptors)
2723
+ self._server: grpc.aio.Server = grpc.aio.server(
2724
+ migration_thread_pool=migration_thread_pool,
2725
+ handlers=handlers,
2726
+ interceptors=interceptors,
2727
+ options=options,
2728
+ maximum_concurrent_rpcs=maximum_concurrent_rpcs,
2729
+ compression=compression,
2730
+ )
2718
2731
  self._service_names: list[str] = []
2719
2732
  self._package_name: str = package_name
2720
2733
  self._port: int = port
File without changes