Azure / azure-functions-python-library

Azure Functions Python SDK
MIT License
150 stars 63 forks source link

No temporary loop for ASGI middleware #148

Closed tonybaloney closed 1 year ago

tonybaloney commented 1 year ago

Fixes https://github.com/Azure/azure-functions-python-library/issues/164

get_event_loop() is deprecated in Python 3.10, but the replacement, get_running_loop() will raise a runtime error if there is no event loop, so asyncio.run() is a better solution, compatible with Python 3.7+.

tonybaloney commented 1 year ago

"compatible with Python 3.7+"

Python 3.6 is failing. Are we still supporting 3.6?

codecov[bot] commented 1 year ago

Codecov Report

Merging #148 (3e61adb) into dev (88ee3fb) will decrease coverage by 0.18%. The diff coverage is 100.00%.

:exclamation: Current head 3e61adb differs from pull request most recent head 732a4c5. Consider uploading reports for the commit 732a4c5 to get more accurate results

@@            Coverage Diff             @@
##              dev     #148      +/-   ##
==========================================
- Coverage   90.26%   90.09%   -0.18%     
==========================================
  Files          51       51              
  Lines        2999     2998       -1     
  Branches      797      796       -1     
==========================================
- Hits         2707     2701       -6     
- Misses        215      220       +5     
  Partials       77       77              
Flag Coverage Δ
unittests 90.06% <100.00%> (-0.18%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
azure/functions/_http_asgi.py 90.21% <100.00%> (-0.21%) :arrow_down:
azure/functions/_http.py 93.04% <0.00%> (-0.18%) :arrow_down:
azure/functions/_abc.py 75.76% <0.00%> (-0.06%) :arrow_down:
azure/functions/decorators/function_app.py 99.44% <0.00%> (-0.01%) :arrow_down:
azure/functions/_sql.py 100.00% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

tonybaloney commented 1 year ago

3.6 isn't supported anymore, I could add a shim for this PR to get the 3.6 test passing, but it would add extra software debt to the project for no reason.

tonybaloney commented 1 year ago

Suggest merging after Azure/azure-functions-python-worker#152

tonybaloney commented 1 year ago

@YunchuWang this is passing now, ready to merge