Move aio module out of experimental folder

pull/23240/head
Lidi Zheng 5 years ago
parent 86aa3579df
commit 5694b798b0
  1. 6
      src/python/grpcio/grpc/BUILD.bazel
  2. 81
      src/python/grpcio/grpc/aio/__init__.py
  3. 0
      src/python/grpcio/grpc/aio/_base_call.py
  4. 0
      src/python/grpcio/grpc/aio/_base_channel.py
  5. 0
      src/python/grpcio/grpc/aio/_base_server.py
  6. 0
      src/python/grpcio/grpc/aio/_call.py
  7. 0
      src/python/grpcio/grpc/aio/_channel.py
  8. 0
      src/python/grpcio/grpc/aio/_interceptor.py
  9. 0
      src/python/grpcio/grpc/aio/_metadata.py
  10. 0
      src/python/grpcio/grpc/aio/_server.py
  11. 0
      src/python/grpcio/grpc/aio/_typing.py
  12. 0
      src/python/grpcio/grpc/aio/_utils.py
  13. 2
      src/python/grpcio/grpc/experimental/__init__.py
  14. 71
      src/python/grpcio/grpc/experimental/aio/__init__.py
  15. 4
      src/python/grpcio_tests/tests_aio/unit/_common.py
  16. 2
      src/python/grpcio_tests/tests_aio/unit/aio_rpc_error_test.py
  17. 2
      src/python/grpcio_tests/tests_aio/unit/close_channel_test.py

@ -66,6 +66,11 @@ py_library(
srcs = ["_simple_stubs.py"],
)
py_library(
name = "aio",
srcs = glob(["aio/**/*.py"]),
)
py_library(
name = "grpcio",
srcs = ["__init__.py"],
@ -74,6 +79,7 @@ py_library(
],
imports = ["../"],
deps = [
":aio",
":utilities",
":auth",
":plugin_wrapping",

@ -0,0 +1,81 @@
# Copyright 2019 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""gRPC's Asynchronous Python API.
gRPC Async API objects may only be used on the thread on which they were
created. AsyncIO doesn't provide thread safety for most of its APIs.
"""
from typing import Any, Optional, Sequence, Tuple
import grpc
from grpc._cython.cygrpc import (init_grpc_aio, shutdown_grpc_aio, EOF,
AbortError, BaseError, InternalError,
UsageError)
from ._base_call import (Call, RpcContext, StreamStreamCall, StreamUnaryCall,
UnaryStreamCall, UnaryUnaryCall)
from ._base_channel import (Channel, StreamStreamMultiCallable,
StreamUnaryMultiCallable, UnaryStreamMultiCallable,
UnaryUnaryMultiCallable)
from ._call import AioRpcError
from ._interceptor import (ClientCallDetails, ClientInterceptor,
InterceptedUnaryUnaryCall,
UnaryUnaryClientInterceptor,
UnaryStreamClientInterceptor,
StreamUnaryClientInterceptor,
StreamStreamClientInterceptor, ServerInterceptor)
from ._server import server
from ._base_server import Server, ServicerContext
from ._typing import ChannelArgumentType
from ._channel import insecure_channel, secure_channel
from ._metadata import Metadata
################################### __all__ #################################
__all__ = (
'init_grpc_aio',
'shutdown_grpc_aio',
'AioRpcError',
'RpcContext',
'Call',
'UnaryUnaryCall',
'UnaryStreamCall',
'StreamUnaryCall',
'StreamStreamCall',
'Channel',
'UnaryUnaryMultiCallable',
'UnaryStreamMultiCallable',
'StreamUnaryMultiCallable',
'StreamStreamMultiCallable',
'ClientCallDetails',
'ClientInterceptor',
'UnaryStreamClientInterceptor',
'UnaryUnaryClientInterceptor',
'StreamUnaryClientInterceptor',
'StreamStreamClientInterceptor',
'InterceptedUnaryUnaryCall',
'ServerInterceptor',
'insecure_channel',
'server',
'Server',
'ServicerContext',
'EOF',
'secure_channel',
'AbortError',
'BaseError',
'UsageError',
'InternalError',
'Metadata',
)

@ -122,6 +122,6 @@ __all__ = (
'wrap_server_method_handler',
)
if sys.version_info[0] == 3 and sys.version_info[1] >= 6:
if sys.version_info > (3, 6):
from grpc._simple_stubs import unary_unary, unary_stream, stream_unary, stream_stream
__all__ = __all__ + (unary_unary, unary_stream, stream_unary, stream_stream)

@ -1,4 +1,4 @@
# Copyright 2019 gRPC authors.
# Copyright 2020 The gRPC Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -11,71 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""gRPC's Asynchronous Python API.
"""Alias of grpc.aio to keep backward compatibility."""
gRPC Async API objects may only be used on the thread on which they were
created. AsyncIO doesn't provide thread safety for most of its APIs.
"""
from typing import Any, Optional, Sequence, Tuple
import grpc
from grpc._cython.cygrpc import (init_grpc_aio, shutdown_grpc_aio, EOF,
AbortError, BaseError, InternalError,
UsageError)
from ._base_call import (Call, RpcContext, StreamStreamCall, StreamUnaryCall,
UnaryStreamCall, UnaryUnaryCall)
from ._base_channel import (Channel, StreamStreamMultiCallable,
StreamUnaryMultiCallable, UnaryStreamMultiCallable,
UnaryUnaryMultiCallable)
from ._call import AioRpcError
from ._interceptor import (ClientCallDetails, ClientInterceptor,
InterceptedUnaryUnaryCall,
UnaryUnaryClientInterceptor,
UnaryStreamClientInterceptor,
StreamUnaryClientInterceptor,
StreamStreamClientInterceptor, ServerInterceptor)
from ._server import server
from ._base_server import Server, ServicerContext
from ._typing import ChannelArgumentType
from ._channel import insecure_channel, secure_channel
from ._metadata import Metadata
################################### __all__ #################################
__all__ = (
'init_grpc_aio',
'shutdown_grpc_aio',
'AioRpcError',
'RpcContext',
'Call',
'UnaryUnaryCall',
'UnaryStreamCall',
'StreamUnaryCall',
'StreamStreamCall',
'Channel',
'UnaryUnaryMultiCallable',
'UnaryStreamMultiCallable',
'StreamUnaryMultiCallable',
'StreamStreamMultiCallable',
'ClientCallDetails',
'ClientInterceptor',
'UnaryStreamClientInterceptor',
'UnaryUnaryClientInterceptor',
'StreamUnaryClientInterceptor',
'StreamStreamClientInterceptor',
'InterceptedUnaryUnaryCall',
'ServerInterceptor',
'insecure_channel',
'server',
'Server',
'ServicerContext',
'EOF',
'secure_channel',
'AbortError',
'BaseError',
'UsageError',
'InternalError',
'Metadata',
)
from grpc.aio import *

@ -16,8 +16,8 @@ import asyncio
import grpc
from typing import AsyncIterable
from grpc.experimental import aio
from grpc.experimental.aio._typing import MetadatumType, MetadataKey, MetadataValue
from grpc.experimental.aio._metadata import Metadata
from grpc.aio._typing import MetadatumType, MetadataKey, MetadataValue
from grpc.aio._metadata import Metadata
from tests.unit.framework.common import test_constants

@ -19,7 +19,7 @@ import unittest
import grpc
from grpc.experimental import aio
from grpc.experimental.aio._call import AioRpcError
from grpc.aio._call import AioRpcError
from tests_aio.unit._test_base import AioTestBase
_TEST_INITIAL_METADATA = aio.Metadata(

@ -19,7 +19,7 @@ import unittest
import grpc
from grpc.experimental import aio
from grpc.experimental.aio import _base_call
from grpc.aio import _base_call
from src.proto.grpc.testing import messages_pb2, test_pb2_grpc
from tests_aio.unit._test_base import AioTestBase

Loading…
Cancel
Save