nucliadb-utils 5.2.1.post1709__py3-none-any.whl → 5.2.1.post1711__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.
@@ -20,6 +20,7 @@
20
20
  import asyncio
21
21
  import os
22
22
  import sys
23
+ from contextlib import AbstractContextManager, nullcontext
23
24
 
24
25
  import click
25
26
  from fastapi import FastAPI
@@ -34,14 +35,11 @@ STARTUP_FAILURE = 3
34
35
 
35
36
 
36
37
  def metrics_app() -> tuple[Server, Config]:
37
- loop_setup = "auto"
38
-
39
38
  metrics_config = Config(
40
39
  application_metrics,
41
40
  host=running_settings.metrics_host,
42
41
  port=running_settings.metrics_port,
43
- debug=False,
44
- loop=loop_setup,
42
+ loop="auto",
45
43
  http="auto",
46
44
  reload=False,
47
45
  workers=1,
@@ -63,14 +61,12 @@ async def serve_metrics() -> Server:
63
61
 
64
62
 
65
63
  def run_fastapi_with_metrics(application: FastAPI) -> None:
66
- loop_setup = "auto"
67
64
  metrics_server, metrics_config = metrics_app()
68
65
  config = Config(
69
66
  application,
70
67
  host=running_settings.serving_host,
71
68
  port=running_settings.serving_port,
72
- debug=running_settings.debug,
73
- loop=loop_setup,
69
+ loop="auto",
74
70
  http="auto",
75
71
  reload=False,
76
72
  workers=1,
@@ -113,14 +109,22 @@ async def run_server_forever(server: Server, config: Config):
113
109
  await start_server(server, config)
114
110
  process_id = os.getpid()
115
111
 
116
- server.install_signal_handlers()
117
-
118
- message = "Started server process [%d]"
119
- color_message = "Started server process [" + click.style("%d", fg="cyan") + "]"
120
- logger.info(message, process_id, extra={"color_message": color_message})
121
-
122
- if server.should_exit:
123
- return
124
-
125
- await server.main_loop()
126
- await server.shutdown()
112
+ # compatibility with uvicorn<0.29
113
+ capture_signals: AbstractContextManager
114
+ if hasattr(server, "install_signal_handlers"): # pragma: no cover
115
+ server.install_signal_handlers()
116
+ capture_signals = nullcontext()
117
+ else:
118
+ # uvicorn>=0.29
119
+ capture_signals = server.capture_signals()
120
+
121
+ with capture_signals:
122
+ message = "Started server process [%d]"
123
+ color_message = "Started server process [" + click.style("%d", fg="cyan") + "]"
124
+ logger.info(message, process_id, extra={"color_message": color_message})
125
+
126
+ if server.should_exit:
127
+ return
128
+
129
+ await server.main_loop()
130
+ await server.shutdown()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nucliadb_utils
3
- Version: 5.2.1.post1709
3
+ Version: 5.2.1.post1711
4
4
  Home-page: https://nuclia.com
5
5
  License: BSD
6
6
  Classifier: Development Status :: 4 - Beta
@@ -24,16 +24,16 @@ Requires-Dist: PyNaCl
24
24
  Requires-Dist: pyjwt>=2.4.0
25
25
  Requires-Dist: memorylru>=1.1.2
26
26
  Requires-Dist: mrflagly>=0.2.9
27
- Requires-Dist: nucliadb-protos>=5.2.1.post1709
28
- Requires-Dist: nucliadb-telemetry>=5.2.1.post1709
27
+ Requires-Dist: nucliadb-protos>=5.2.1.post1711
28
+ Requires-Dist: nucliadb-telemetry>=5.2.1.post1711
29
29
  Provides-Extra: cache
30
30
  Requires-Dist: redis>=4.3.4; extra == "cache"
31
31
  Requires-Dist: orjson>=3.6.7; extra == "cache"
32
32
  Requires-Dist: lru-dict>=1.1.7; extra == "cache"
33
33
  Provides-Extra: fastapi
34
34
  Requires-Dist: fastapi>=0.95.2; extra == "fastapi"
35
- Requires-Dist: uvicorn<0.19.0,>=0.16.0; extra == "fastapi"
36
35
  Requires-Dist: starlette>=0.21.0; extra == "fastapi"
36
+ Requires-Dist: uvicorn; extra == "fastapi"
37
37
  Provides-Extra: storages
38
38
  Requires-Dist: oauth2client>=4.1.3; extra == "storages"
39
39
  Requires-Dist: aiobotocore>=2.9.0; extra == "storages"
@@ -34,7 +34,7 @@ nucliadb_utils/encryption/__init__.py,sha256=oav6jFOTGgmIen88sdmy-bCK-uj1tyDt2hr
34
34
  nucliadb_utils/encryption/settings.py,sha256=yF2AW6c_mu0yWbBn1grAERDAqDvKIpXqQnwD0OFmROI,1467
35
35
  nucliadb_utils/fastapi/__init__.py,sha256=itSI7dtTwFP55YMX4iK7JzdMHS5CQVUiB1XzQu4UBh8,833
36
36
  nucliadb_utils/fastapi/openapi.py,sha256=b0pLuri0QuzQd0elDyOVXM42YYmES_cmT-jEfsQ1G6Y,1737
37
- nucliadb_utils/fastapi/run.py,sha256=n6vOX64QqF1I5n4UlKnpm_ZJ24rmwfRGi-J9YMGpZzA,3631
37
+ nucliadb_utils/fastapi/run.py,sha256=OVuzjfsX_8IdVXKuK-RsIVf2OdP6t8h9DLfEn2P_-KI,3910
38
38
  nucliadb_utils/fastapi/versioning.py,sha256=pwiwuesJW1jElUUI3pI5kcxkigfGBvI64IL6QCBEWS8,3805
39
39
  nucliadb_utils/nuclia_usage/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
40
40
  nucliadb_utils/nuclia_usage/utils/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
@@ -59,8 +59,8 @@ nucliadb_utils/tests/indexing.py,sha256=YW2QhkhO9Q_8A4kKWJaWSvXvyQ_AiAwY1VylcfVQ
59
59
  nucliadb_utils/tests/local.py,sha256=7nuP8EFUAiA8ZH50R1iPV9EUXBySQxOanVm3Zht_e0g,1835
60
60
  nucliadb_utils/tests/nats.py,sha256=xqpww4jZjTKY9oPGlJdDJG67L3FIBQsa9qDHxILR8r8,7687
61
61
  nucliadb_utils/tests/s3.py,sha256=IdMxK_cNdSHLvO1u8BwsKFzD87Hk1MVPDZ57zx6h-rA,3656
62
- nucliadb_utils-5.2.1.post1709.dist-info/METADATA,sha256=-FJ__SfHJPJQJYWvSKaG9jWboA-DvAhULcXg7VMJRrg,2071
63
- nucliadb_utils-5.2.1.post1709.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
64
- nucliadb_utils-5.2.1.post1709.dist-info/top_level.txt,sha256=fE3vJtALTfgh7bcAWcNhcfXkNPp_eVVpbKK-2IYua3E,15
65
- nucliadb_utils-5.2.1.post1709.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
66
- nucliadb_utils-5.2.1.post1709.dist-info/RECORD,,
62
+ nucliadb_utils-5.2.1.post1711.dist-info/METADATA,sha256=HFkBvfyWw4wN07YoUBqeaXbfYPTOlTzmUXQ6oVkblhY,2055
63
+ nucliadb_utils-5.2.1.post1711.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
64
+ nucliadb_utils-5.2.1.post1711.dist-info/top_level.txt,sha256=fE3vJtALTfgh7bcAWcNhcfXkNPp_eVVpbKK-2IYua3E,15
65
+ nucliadb_utils-5.2.1.post1711.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
66
+ nucliadb_utils-5.2.1.post1711.dist-info/RECORD,,