Selaa lähdekoodia

Bump uvicorn on Python projects (#8000)

* Bump uvicorn on Python projects

* Fix uvicorn tests

* Revert apidaora changes

* Revert routling changes
Marcelo Trylesinski 2 vuotta sitten
vanhempi
commit
38ac917baa

+ 4 - 3
frameworks/Python/crax/requirements.txt

@@ -1,4 +1,5 @@
 crax[postgresql]==0.1.5
-gunicorn==20.0.4
-uvloop==0.14.0
-uvicorn==0.11.8
+gunicorn==20.1.0
+uvloop==0.17.0
+uvicorn==0.20.0
+httptools==0.5.0

+ 2 - 0
frameworks/Python/falcon/requirements.txt

@@ -8,5 +8,7 @@ orjson==3.6.5
 pony==0.7.16
 psycopg2-binary==2.9.3; implementation_name=='cpython'
 tortoise-orm==0.19.2
+httptools==0.5.0
+uvloop==0.17.0
 uvicorn==0.20.0
 waitress==2.1.2

+ 3 - 2
frameworks/Python/responder/requirements.txt

@@ -2,6 +2,7 @@ asyncpg==0.21.0
 gunicorn==20.0.4
 Jinja2==2.11.3
 ujson==2.0.3
-uvloop==0.14.0
-uvicorn==0.11.7
+uvloop==0.17.0
+httptools==0.5.0
+uvicorn==0.20.0
 responder==2.0.5

+ 3 - 9
frameworks/Python/starlette/requirements.txt

@@ -1,17 +1,11 @@
-anyio==3.6.1
 asyncpg==0.26.0
-click==8.1.3
 gunicorn==20.1.0
-h11==0.13.0
-httptools==0.4.0
+httptools==0.5.0
 idna==3.3
 Jinja2==3.1.2
 MarkupSafe==2.1.1
 python-dotenv==0.20.0
 PyYAML==6.0
-sniffio==1.3.0
 starlette==0.25.0
-uvicorn==0.18.3
-uvloop==0.16.0
-watchfiles==0.16.1
-websockets==10.3
+uvicorn==0.20.0
+uvloop==0.17.0

+ 5 - 3
frameworks/Python/uvicorn/app.py

@@ -57,9 +57,6 @@ with open(path, 'r') as template_file:
     template_text = template_file.read()
     template = jinja2.Template(template_text)
 
-loop = asyncio.get_event_loop()
-loop.run_until_complete(setup())
-
 
 def get_num_queries(scope):
     try:
@@ -216,6 +213,11 @@ routes = {
 
 
 async def main(scope, receive, send):
+    if scope['type'] == 'lifespan':
+        message = await receive()
+        if message['type'] == 'lifespan.startup':
+            await setup()
+            await send({'type': 'lifespan.startup.complete'})
     path = scope['path']
     handler = routes.get(path, handle_404)
     await handler(scope, receive, send)

+ 4 - 3
frameworks/Python/uvicorn/requirements.txt

@@ -1,6 +1,7 @@
 asyncpg==0.21.0
-gunicorn==20.0.4
+gunicorn==20.1.0
+httptools==0.5.0
 Jinja2==3.0.3
 ujson==5.4.0
-uvloop==0.14.0
-uvicorn==0.11.7
+uvloop==0.17.0
+uvicorn==0.20.0