Azure / azure-functions-python-worker

Python worker for Azure Functions.
http://aka.ms/azurefunctions
MIT License
335 stars 103 forks source link

Removed library imports from the worker #1046

Closed gavin-aguiar closed 2 years ago

gavin-aguiar commented 2 years ago

Removed library imports from the worker and only imported them in the function that they are used.

This should fix the users who have pinned their azure functions to a version older than 1.10.1.

Error seen for users with older pinned azure functions version ERROR: unhandled error in functions worker,ImportError: cannot import name 'DataType' from 'azure.functions'

Description

Fixes #


PR information

Quality of Code and Contribution Guidelines

codecov[bot] commented 2 years ago

Codecov Report

Merging #1046 (8a80fbf) into dev (bcda54d) will increase coverage by 50.84%. The diff coverage is 100.00%.

:exclamation: Current head 8a80fbf differs from pull request most recent head b5c6caf. Consider uploading reports for the commit b5c6caf to get more accurate results

@@             Coverage Diff             @@
##              dev    #1046       +/-   ##
===========================================
+ Coverage   31.97%   82.81%   +50.84%     
===========================================
  Files          33       33               
  Lines        1764     1775       +11     
  Branches      282      282               
===========================================
+ Hits          564     1470      +906     
+ Misses       1199      235      -964     
- Partials        1       70       +69     
Flag Coverage Δ
unittests 82.81% <100.00%> (+50.84%) :arrow_up:

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

Impacted Files Coverage Δ
azure_functions_worker/functions.py 96.04% <100.00%> (+71.88%) :arrow_up:
azure_functions_worker/loader.py 84.52% <100.00%> (+51.19%) :arrow_up:
azure_functions_worker/constants.py 100.00% <0.00%> (ø)
...ed_memory_data_transfer/shared_memory_constants.py 100.00% <0.00%> (ø)
azure_functions_worker/logging.py 40.90% <0.00%> (+4.54%) :arrow_up:
...ared_memory_data_transfer/file_accessor_factory.py 73.33% <0.00%> (+6.66%) :arrow_up:
azure_functions_worker/bindings/tracecontext.py 75.00% <0.00%> (+12.50%) :arrow_up:
azure_functions_worker/bindings/retrycontext.py 80.00% <0.00%> (+20.00%) :arrow_up:
azure_functions_worker/bindings/context.py 87.50% <0.00%> (+29.16%) :arrow_up:
...dings/shared_memory_data_transfer/file_accessor.py 84.37% <0.00%> (+31.25%) :arrow_up:
... and 17 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update bcda54d...b5c6caf. Read the comment docs.

YunchuWang commented 2 years ago

@gavin-aguiar codecov failed, plz add some tests