aiomisc 17.3.39__py3-none-any.whl → 17.3.48__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.
@@ -11,6 +11,7 @@ from .base import Service
11
11
 
12
12
  try:
13
13
  import grpc.aio
14
+ from grpc_reflection.v1alpha import reflection
14
15
  except ImportError as e:
15
16
  raise ImportError(
16
17
  "You must install 'grpcio' manually or using extras 'aiomisc[grpc]'",
@@ -39,11 +40,12 @@ class GRPCService(Service):
39
40
  def __init__(
40
41
  self, *,
41
42
  migration_thread_pool: Optional[Executor] = None,
42
- handlers: Optional[Sequence[grpc.GenericRpcHandler]] = None,
43
+ handlers: Optional[Sequence[grpc.ServiceRpcHandler]] = None,
43
44
  interceptors: Optional[Sequence[Any]] = None,
44
45
  options: Optional[Sequence[Tuple[str, Any]]] = None,
45
46
  maximum_concurrent_rpcs: Optional[int] = None,
46
47
  compression: Optional[grpc.Compression] = None,
48
+ reflection: bool = False,
47
49
  **kwds: Any,
48
50
  ):
49
51
  self._server_args = MappingProxyType({
@@ -54,9 +56,10 @@ class GRPCService(Service):
54
56
  "migration_thread_pool": migration_thread_pool,
55
57
  "options": options,
56
58
  })
57
- self._services: Set[grpc.GenericRpcHandler] = set()
59
+ self._services: Set[grpc.ServiceRpcHandler] = set()
58
60
  self._insecure_ports = set()
59
61
  self._secure_ports = set()
62
+ self._reflection = reflection
60
63
  super().__init__(**kwds)
61
64
 
62
65
  @classmethod
@@ -82,6 +85,11 @@ class GRPCService(Service):
82
85
  future.set_result(port)
83
86
  self._log_port("Listening secure address", address, port)
84
87
 
88
+ if self._reflection:
89
+ service_names = [x.service_name() for x in self._services]
90
+ service_names.append(reflection.SERVICE_NAME)
91
+ reflection.enable_server_reflection(service_names, self._server)
92
+
85
93
  self._server.add_generic_rpc_handlers(tuple(self._services))
86
94
  await self._server.start()
87
95
 
@@ -89,7 +97,7 @@ class GRPCService(Service):
89
97
  await self._server.stop(self.GRACEFUL_STOP_TIME)
90
98
 
91
99
  def add_generic_rpc_handlers(
92
- self, generic_rpc_handlers: Sequence[grpc.GenericRpcHandler],
100
+ self, generic_rpc_handlers: Sequence[grpc.ServiceRpcHandler],
93
101
  ) -> None:
94
102
  for service in generic_rpc_handlers:
95
103
  self._services.add(service)
aiomisc/version.py CHANGED
@@ -2,5 +2,5 @@
2
2
  # BY: poem-plugins "git" plugin
3
3
  # NEVER EDIT THIS FILE MANUALLY
4
4
 
5
- version_info = (17, 3, 39)
6
- __version__ = "17.3.39"
5
+ version_info = (17, 3, 48)
6
+ __version__ = "17.3.48"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: aiomisc
3
- Version: 17.3.39
3
+ Version: 17.3.48
4
4
  Summary: aiomisc - miscellaneous utils for asyncio
5
5
  Home-page: https://github.com/aiokitchen/aiomisc
6
6
  License: MIT
@@ -56,8 +56,9 @@ Requires-Dist: aiohttp-asgi (>=0.5.2,<0.6.0) ; extra == "asgi"
56
56
  Requires-Dist: asgiref (>=3.7,<4) ; extra == "uvicorn"
57
57
  Requires-Dist: colorlog (>=6.0,<7.0)
58
58
  Requires-Dist: croniter (>=1.3.8,<2.0.0) ; extra == "cron"
59
- Requires-Dist: grpcio (>=1.56.0,<2.0.0) ; extra == "grpc"
60
- Requires-Dist: grpcio-tools (>=1.56.0,<2.0.0) ; extra == "grpc"
59
+ Requires-Dist: grpcio (>=1.56,<2.0) ; extra == "grpc"
60
+ Requires-Dist: grpcio-reflection (>=1.56,<2.0) ; extra == "grpc"
61
+ Requires-Dist: grpcio-tools (>=1.56,<2.0) ; extra == "grpc"
61
62
  Requires-Dist: logging-journald ; sys_platform == "linux"
62
63
  Requires-Dist: raven ; extra == "raven"
63
64
  Requires-Dist: rich ; extra == "rich"
@@ -171,6 +172,8 @@ Complete table of extras bellow:
171
172
  +-----------------------------------+------------------------------------------------+
172
173
  | ``pip install aiomisc[rich]`` | You might using rich_ for logging |
173
174
  +-----------------------------------+------------------------------------------------+
175
+ | ``pip install aiomisc[uvicorn]`` | For running ASGI_ application using uvicorn_ |
176
+ +-----------------------------------+------------------------------------------------+
174
177
  | ``pip install aiomisc[uvloop]`` | use uvloop_ as a default event loop |
175
178
  +-----------------------------------+------------------------------------------------+
176
179
 
@@ -184,6 +187,7 @@ Complete table of extras bellow:
184
187
  .. _rich: https://pypi.org/project/rich
185
188
  .. _sentry: https://sentry.io/
186
189
  .. _uvloop: https://pypi.org/project/uvloop
190
+ .. _uvicorn: https://pypi.org/project/uvicorn
187
191
 
188
192
  You can combine extras values by separating them with commas, for example:
189
193
 
@@ -24,7 +24,7 @@ aiomisc/service/asgi.py,sha256=S6ejgg7GpHfUzuj46g8QuLXTHn0YWwqI_pAGbXfoNjE,1583
24
24
  aiomisc/service/base.py,sha256=Jo2kVnMXQ-ajLxa8Vzguq-sMWTyvIoa-VOH_ZOrcmns,4321
25
25
  aiomisc/service/carbon.py,sha256=o7x2LYUOfCcWYDAP9EFdCTtsduXhqkyMAuIqVio9YsM,1743
26
26
  aiomisc/service/cron.py,sha256=wnI68_OvQqYeFTwoC-D63jqmebgSMp7uvPYsc1UFd-U,1941
27
- aiomisc/service/grpc_server.py,sha256=O8D4TGJ2n8tLkESu-INQ3hox6RyvkmkSyy8iVgxps-0,3569
27
+ aiomisc/service/grpc_server.py,sha256=zfUItQlxAMj2ugb9ekKX_5Pxb_VCHOv5Q4U-iOKpx9g,3928
28
28
  aiomisc/service/periodic.py,sha256=BEKGWxWDOX11sfo7MFYp-hiB5iZ4-c2BRsjS56k5B-0,1241
29
29
  aiomisc/service/process.py,sha256=mZf8muZJNWQo95pUmzchMk08MJMhLifFK8m4CnNX49k,4477
30
30
  aiomisc/service/profiler.py,sha256=6KiJsU7tD5eO4YKZXYujV2E8P-G8GUqLAGIl0AuPNG4,1503
@@ -39,7 +39,7 @@ aiomisc/signal.py,sha256=-4d3T78-si8sBoWrrf0tt_TShaHhWs6gnlPCx8oyZLA,1727
39
39
  aiomisc/thread_pool.py,sha256=RvDxkUj9G5ULgjDsBdo0dInIUJ95zxXOnGHHRT1sgpY,12125
40
40
  aiomisc/timeout.py,sha256=B4gDv6eXs5XHicjRifRc-Z1L7OBACyh-_QA1iAdv4g4,678
41
41
  aiomisc/utils.py,sha256=6yTfTpeRCVzfZp-MJCmB1oayOHUBVwQwzC3U5PBAjn8,11919
42
- aiomisc/version.py,sha256=dFBLwmzRDg7EnnjHSw0WvvyLZQ5BmYXScxwml9v62wc,156
42
+ aiomisc/version.py,sha256=sBWVpq1nPKeX-vAxUqbMyKORn_QQXSvnJ6joWc4o4_M,156
43
43
  aiomisc/worker_pool.py,sha256=SDi1rk0K6NxpQ7PtAv9ch9SG5UkEh0GZXDfqeuztFuU,10874
44
44
  aiomisc_log/__init__.py,sha256=7vhs6dg3J36mViNPjTpHA9enLxnVP-bf3XREYV6wNWc,4416
45
45
  aiomisc_log/enum.py,sha256=SkGpP70sjruOx0pzZfJZTbbrtNIarKmdtaFE7zQ2Hzk,1525
@@ -57,8 +57,8 @@ aiomisc_worker/process_inner.py,sha256=8ZtjCSLrgySW57OIbuGrpEWxfysRLYKx1or1YaAqx
57
57
  aiomisc_worker/protocol.py,sha256=1smmlBbdreSmnrxuhHaUMUC10FO9xMIEcedhweQJX_A,2705
58
58
  aiomisc_worker/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
59
59
  aiomisc_worker/worker.py,sha256=f8nCFhlKh84UUBUaEgCllwMRvVZiD8_UUXaeit6g3T8,3236
60
- aiomisc-17.3.39.dist-info/COPYING,sha256=Ky_8CQMaIixfyOreUBsl0hKN6A5fLnPF8KPQ9molMYA,1125
61
- aiomisc-17.3.39.dist-info/METADATA,sha256=ecIgCN_prpp67r2SqFAXD17I7gC6Lh-Qag5da9cdViE,15441
62
- aiomisc-17.3.39.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
63
- aiomisc-17.3.39.dist-info/entry_points.txt,sha256=KRsSPCwKJyGTWrvzpwbS0yIDwzsgDA2X6f0CBWYmNao,55
64
- aiomisc-17.3.39.dist-info/RECORD,,
60
+ aiomisc-17.3.48.dist-info/COPYING,sha256=Ky_8CQMaIixfyOreUBsl0hKN6A5fLnPF8KPQ9molMYA,1125
61
+ aiomisc-17.3.48.dist-info/METADATA,sha256=eKB2jvx7HO84IbzHkBv9n6THKL9ZjX-6Sddp5yj4QZM,15718
62
+ aiomisc-17.3.48.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
63
+ aiomisc-17.3.48.dist-info/entry_points.txt,sha256=KRsSPCwKJyGTWrvzpwbS0yIDwzsgDA2X6f0CBWYmNao,55
64
+ aiomisc-17.3.48.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.8.1
2
+ Generator: poetry-core 1.9.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any