azure-functions-runtime 1.0.0a1__tar.gz

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.
Files changed (54) hide show
  1. azure_functions_runtime-1.0.0a1/LICENSE +21 -0
  2. azure_functions_runtime-1.0.0a1/MANIFEST.in +3 -0
  3. azure_functions_runtime-1.0.0a1/PKG-INFO +159 -0
  4. azure_functions_runtime-1.0.0a1/README.md +74 -0
  5. azure_functions_runtime-1.0.0a1/azure_functions_runtime.egg-info/PKG-INFO +159 -0
  6. azure_functions_runtime-1.0.0a1/azure_functions_runtime.egg-info/SOURCES.txt +53 -0
  7. azure_functions_runtime-1.0.0a1/azure_functions_runtime.egg-info/dependency_links.txt +1 -0
  8. azure_functions_runtime-1.0.0a1/azure_functions_runtime.egg-info/requires.txt +49 -0
  9. azure_functions_runtime-1.0.0a1/azure_functions_runtime.egg-info/top_level.txt +5 -0
  10. azure_functions_runtime-1.0.0a1/azure_functions_worker_v2/__init__.py +14 -0
  11. azure_functions_runtime-1.0.0a1/azure_functions_worker_v2/bindings/context.py +67 -0
  12. azure_functions_runtime-1.0.0a1/azure_functions_worker_v2/bindings/datumdef.py +232 -0
  13. azure_functions_runtime-1.0.0a1/azure_functions_worker_v2/bindings/generic.py +74 -0
  14. azure_functions_runtime-1.0.0a1/azure_functions_worker_v2/bindings/meta.py +290 -0
  15. azure_functions_runtime-1.0.0a1/azure_functions_worker_v2/bindings/nullable_converters.py +115 -0
  16. azure_functions_runtime-1.0.0a1/azure_functions_worker_v2/bindings/out.py +16 -0
  17. azure_functions_runtime-1.0.0a1/azure_functions_worker_v2/bindings/retrycontext.py +48 -0
  18. azure_functions_runtime-1.0.0a1/azure_functions_worker_v2/bindings/tracecontext.py +44 -0
  19. azure_functions_runtime-1.0.0a1/azure_functions_worker_v2/functions.py +431 -0
  20. azure_functions_runtime-1.0.0a1/azure_functions_worker_v2/handle_event.py +437 -0
  21. azure_functions_runtime-1.0.0a1/azure_functions_worker_v2/http_v2.py +290 -0
  22. azure_functions_runtime-1.0.0a1/azure_functions_worker_v2/loader.py +207 -0
  23. azure_functions_runtime-1.0.0a1/azure_functions_worker_v2/logging.py +16 -0
  24. azure_functions_runtime-1.0.0a1/azure_functions_worker_v2/otel.py +113 -0
  25. azure_functions_runtime-1.0.0a1/azure_functions_worker_v2/utils/__init__.py +2 -0
  26. azure_functions_runtime-1.0.0a1/azure_functions_worker_v2/utils/app_setting_manager.py +29 -0
  27. azure_functions_runtime-1.0.0a1/azure_functions_worker_v2/utils/constants.py +92 -0
  28. azure_functions_runtime-1.0.0a1/azure_functions_worker_v2/utils/current.py +35 -0
  29. azure_functions_runtime-1.0.0a1/azure_functions_worker_v2/utils/env_state.py +75 -0
  30. azure_functions_runtime-1.0.0a1/azure_functions_worker_v2/utils/helpers.py +28 -0
  31. azure_functions_runtime-1.0.0a1/azure_functions_worker_v2/utils/tracing.py +54 -0
  32. azure_functions_runtime-1.0.0a1/azure_functions_worker_v2/utils/typing_inspect.py +295 -0
  33. azure_functions_runtime-1.0.0a1/azure_functions_worker_v2/utils/validators.py +20 -0
  34. azure_functions_runtime-1.0.0a1/azure_functions_worker_v2/utils/wrappers.py +50 -0
  35. azure_functions_runtime-1.0.0a1/azure_functions_worker_v2/version.py +4 -0
  36. azure_functions_runtime-1.0.0a1/pyproject.toml +115 -0
  37. azure_functions_runtime-1.0.0a1/setup.cfg +25 -0
  38. azure_functions_runtime-1.0.0a1/tests/protos/FunctionRpc_pb2.py +215 -0
  39. azure_functions_runtime-1.0.0a1/tests/protos/FunctionRpc_pb2_grpc.py +69 -0
  40. azure_functions_runtime-1.0.0a1/tests/protos/__init__.py +43 -0
  41. azure_functions_runtime-1.0.0a1/tests/protos/identity/ClaimsIdentityRpc_pb2.py +29 -0
  42. azure_functions_runtime-1.0.0a1/tests/protos/identity/ClaimsIdentityRpc_pb2_grpc.py +4 -0
  43. azure_functions_runtime-1.0.0a1/tests/protos/identity/__init__.py +0 -0
  44. azure_functions_runtime-1.0.0a1/tests/protos/shared/NullableTypes_pb2.py +33 -0
  45. azure_functions_runtime-1.0.0a1/tests/protos/shared/NullableTypes_pb2_grpc.py +4 -0
  46. azure_functions_runtime-1.0.0a1/tests/protos/shared/__init__.py +0 -0
  47. azure_functions_runtime-1.0.0a1/tests/unittests/basic_function/function_app.py +44 -0
  48. azure_functions_runtime-1.0.0a1/tests/unittests/indexing_exception_function/function_app.py +35 -0
  49. azure_functions_runtime-1.0.0a1/tests/unittests/streaming_function/function_app.py +100 -0
  50. azure_functions_runtime-1.0.0a1/tests/unittests/test_code_quality.py +54 -0
  51. azure_functions_runtime-1.0.0a1/tests/unittests/test_handle_event.py +233 -0
  52. azure_functions_runtime-1.0.0a1/tests/utils/__init__.py +2 -0
  53. azure_functions_runtime-1.0.0a1/tests/utils/constants.py +7 -0
  54. azure_functions_runtime-1.0.0a1/tests/utils/testutils.py +34 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Microsoft Corporation. All rights reserved.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE
@@ -0,0 +1,3 @@
1
+ recursive-include azure *.py *.pyi
2
+ recursive-include tests *.py *.json
3
+ include LICENSE README.md
@@ -0,0 +1,159 @@
1
+ Metadata-Version: 2.4
2
+ Name: azure-functions-runtime
3
+ Version: 1.0.0a1
4
+ Summary: Python Language Worker for Azure Functions Runtime
5
+ Author-email: "Azure Functions team at Microsoft Corp." <azurefunctions@microsoft.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) Microsoft Corporation. All rights reserved.
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE
27
+
28
+ Project-URL: Documentation, https://github.com/Azure/azure-functions-python-worker?tab=readme-ov-file#-azure-functions-python-worker
29
+ Project-URL: Repository, https://github.com/Azure/azure-functions-python-worker
30
+ Keywords: azure,functions,azurefunctions,python,serverless
31
+ Classifier: Development Status :: 5 - Production/Stable
32
+ Classifier: Programming Language :: Python
33
+ Classifier: Programming Language :: Python :: 3
34
+ Classifier: Programming Language :: Python :: 3.13
35
+ Classifier: Operating System :: Microsoft :: Windows
36
+ Classifier: Operating System :: POSIX
37
+ Classifier: Operating System :: MacOS :: MacOS X
38
+ Classifier: Environment :: Web Environment
39
+ Classifier: License :: OSI Approved :: MIT License
40
+ Classifier: Intended Audience :: Developers
41
+ Requires-Python: >=3.13
42
+ Description-Content-Type: text/markdown
43
+ License-File: LICENSE
44
+ Requires-Dist: azurefunctions-extensions-base; python_version >= "3.8"
45
+ Requires-Dist: azure-functions
46
+ Provides-Extra: dev
47
+ Requires-Dist: azure-eventhub; extra == "dev"
48
+ Requires-Dist: azure-functions-durable; extra == "dev"
49
+ Requires-Dist: azure-monitor-opentelemetry; python_version >= "3.8" and extra == "dev"
50
+ Requires-Dist: flask; extra == "dev"
51
+ Requires-Dist: fastapi~=0.103.2; extra == "dev"
52
+ Requires-Dist: pydantic; extra == "dev"
53
+ Requires-Dist: pycryptodome==3.*; extra == "dev"
54
+ Requires-Dist: flake8==5.*; python_version == "3.7" and extra == "dev"
55
+ Requires-Dist: flake8==6.*; python_version >= "3.8" and extra == "dev"
56
+ Requires-Dist: mypy; extra == "dev"
57
+ Requires-Dist: pytest; extra == "dev"
58
+ Requires-Dist: requests==2.*; extra == "dev"
59
+ Requires-Dist: coverage; extra == "dev"
60
+ Requires-Dist: grpcio~=1.70.0; extra == "dev"
61
+ Requires-Dist: grpcio-tools~=1.70.0; extra == "dev"
62
+ Requires-Dist: pytest-sugar; extra == "dev"
63
+ Requires-Dist: opentelemetry-api; python_version >= "3.8" and extra == "dev"
64
+ Requires-Dist: pytest-cov; extra == "dev"
65
+ Requires-Dist: pytest-xdist; extra == "dev"
66
+ Requires-Dist: pytest-randomly; extra == "dev"
67
+ Requires-Dist: pytest-instafail; extra == "dev"
68
+ Requires-Dist: pytest-rerunfailures; extra == "dev"
69
+ Requires-Dist: ptvsd; extra == "dev"
70
+ Requires-Dist: python-dotenv; extra == "dev"
71
+ Requires-Dist: plotly; extra == "dev"
72
+ Requires-Dist: scikit-learn; extra == "dev"
73
+ Requires-Dist: opencv-python; extra == "dev"
74
+ Requires-Dist: pandas; extra == "dev"
75
+ Requires-Dist: numpy; extra == "dev"
76
+ Requires-Dist: pre-commit; extra == "dev"
77
+ Requires-Dist: invoke; extra == "dev"
78
+ Provides-Extra: test-http-v2
79
+ Requires-Dist: azurefunctions-extensions-http-fastapi==1.0.0b2; extra == "test-http-v2"
80
+ Requires-Dist: ujson; extra == "test-http-v2"
81
+ Requires-Dist: orjson; extra == "test-http-v2"
82
+ Provides-Extra: test-deferred-bindings
83
+ Requires-Dist: azurefunctions-extensions-bindings-blob==1.0.0b3; extra == "test-deferred-bindings"
84
+ Dynamic: license-file
85
+
86
+ # <img src="https://raw.githubusercontent.com/Azure/azure-functions-python-worker/dev/docs/Azure.Functions.svg" width = "30" alt="Functions Header Image - Lightning Logo"> Azure Functions Python Worker
87
+
88
+ | Branch | Build Status | CodeCov | Test Status |
89
+ |--------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
90
+ | dev | [![Build Status](https://img.shields.io/azure-devops/build/azfunc/public/658/dev)](https://azfunc.visualstudio.com/public/_build/latest?definitionId=658&branchName=dev) | [![codecov](https://codecov.io/gh/Azure/azure-functions-python-worker/branch/dev/graph/badge.svg)](https://codecov.io/gh/Azure/azure-functions-python-worker) | [![Test Status](https://img.shields.io/azure-devops/build/azfunc/public/658/dev)](https://azfunc.visualstudio.com/public/_build/latest?definitionId=658&branchName=dev) |
91
+
92
+ Python support for Azure Functions is based on Python 3.8, 3.9, 3.10, 3.11, and 3.12 serverless hosting on Linux and the Functions 4.0 runtime.
93
+
94
+ Here is the current status of Python in Azure Functions:
95
+
96
+ What are the supported Python versions?
97
+
98
+ | Azure Functions Runtime | Python 3.8 | Python 3.9 | Python 3.10 | Python 3.11 | Python 3.12 |
99
+ |----------------------------------|------------|------------|-------------|-------------|-------------|
100
+ | Azure Functions 3.0 (deprecated) | ✔ | ✔ | - | - | - |
101
+ | Azure Functions 4.0 | ✔ | ✔ | ✔ | ✔ | ✔ |
102
+
103
+ For information about Azure Functions Runtime, please refer to [Azure Functions runtime versions overview](https://docs.microsoft.com/en-us/azure/azure-functions/functions-versions) page.
104
+
105
+ ### What's available?
106
+
107
+ - Build, test, debug, and publish using Azure Functions Core Tools (CLI) or Visual Studio Code
108
+ - Deploy Python Function project onto consumption, dedicated, elastic premium, or flex consumption plan.
109
+ - Deploy Python Function project in a custom docker image onto dedicated or elastic premium plan.
110
+ - Triggers / Bindings : Blob, Cosmos DB, Event Grid, Event Hub, HTTP, Kafka, MySQL, Queue, ServiceBus, SQL, Timer, and Warmup
111
+ - Triggers / Bindings : Custom binding support
112
+
113
+ ### What's new?
114
+
115
+ - [SDK Type Bindings for Blob](https://techcommunity.microsoft.com/t5/azure-compute-blog/azure-functions-sdk-type-bindings-for-azure-blob-storage-with/ba-p/4146744)
116
+ - [HTTP Streaming](https://techcommunity.microsoft.com/t5/azure-compute-blog/azure-functions-support-for-http-streams-in-python-is-now-in/ba-p/4146697)
117
+
118
+ ### Get Started
119
+
120
+ - [Create your first Python function](https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-function-python)
121
+ - [Developer guide](https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-python)
122
+ - [Binding API reference](https://docs.microsoft.com/en-us/python/api/azure-functions/azure.functions?view=azure-python)
123
+ - [Develop using VS Code](https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-function-vs-code)
124
+ - [Create a Python Function on Linux using a custom docker image](https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-function-linux-custom-image)
125
+
126
+ # Give Feedback
127
+
128
+ Issues and feature requests are tracked in a variety of places. To report this feedback, please file an issue to the relevant repository below:
129
+
130
+ | Item | Description | Link |
131
+ |---------------|----------------------------------------------|--------------------------------------------------------------------------------|
132
+ | Python Worker | Programming Model, Triggers & Bindings | [File an Issue](https://github.com/Azure/azure-functions-python-worker/issues) |
133
+ | Linux | Base Docker Images | [File an Issue](https://github.com/Azure/azure-functions-docker/issues) |
134
+ | Runtime | Script Host & Language Extensibility | [File an Issue](https://github.com/Azure/azure-functions-host/issues) |
135
+ | VSCode | VSCode Extension for Azure Functions | [File an Issue](https://github.com/microsoft/vscode-azurefunctions/issues) |
136
+ | Core Tools | Command Line Interface for Local Development | [File an Issue](https://github.com/Azure/azure-functions-core-tools/issues) |
137
+ | Portal | User Interface or Experience Issue | [File an Issue](https://github.com/azure/azure-functions-ux/issues) |
138
+ | Templates | Code Issues with Creation Template | [File an Issue](https://github.com/Azure/azure-functions-templates/issues) |
139
+
140
+ # Contribute
141
+
142
+ This project welcomes contributions and suggestions. Most contributions require you to agree to a
143
+ Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
144
+ the rights to use your contribution. For details, visit https://cla.microsoft.com.
145
+
146
+ Here are some pointers to get started:
147
+
148
+ - [Language worker architecture](https://github.com/Azure/azure-functions-python-worker/wiki/Worker-Architecture)
149
+ - [Setting up the development environment](https://github.com/Azure/azure-functions-python-worker/wiki/Contributor-Guide)
150
+ - [Adding support for a new binding](https://github.com/Azure/azure-functions-python-worker/wiki/Adding-support-for-a-new-binding-type)
151
+ - [Release instructions](https://github.com/Azure/azure-functions-python-worker/wiki/Release-Instructions)
152
+
153
+ When you submit a pull request, a CLA-bot will automatically determine whether you need to provide
154
+ a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
155
+ provided by the bot. You will only need to do this once across all repos using our CLA.
156
+
157
+ This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
158
+ For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
159
+ contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
@@ -0,0 +1,74 @@
1
+ # <img src="https://raw.githubusercontent.com/Azure/azure-functions-python-worker/dev/docs/Azure.Functions.svg" width = "30" alt="Functions Header Image - Lightning Logo"> Azure Functions Python Worker
2
+
3
+ | Branch | Build Status | CodeCov | Test Status |
4
+ |--------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
5
+ | dev | [![Build Status](https://img.shields.io/azure-devops/build/azfunc/public/658/dev)](https://azfunc.visualstudio.com/public/_build/latest?definitionId=658&branchName=dev) | [![codecov](https://codecov.io/gh/Azure/azure-functions-python-worker/branch/dev/graph/badge.svg)](https://codecov.io/gh/Azure/azure-functions-python-worker) | [![Test Status](https://img.shields.io/azure-devops/build/azfunc/public/658/dev)](https://azfunc.visualstudio.com/public/_build/latest?definitionId=658&branchName=dev) |
6
+
7
+ Python support for Azure Functions is based on Python 3.8, 3.9, 3.10, 3.11, and 3.12 serverless hosting on Linux and the Functions 4.0 runtime.
8
+
9
+ Here is the current status of Python in Azure Functions:
10
+
11
+ What are the supported Python versions?
12
+
13
+ | Azure Functions Runtime | Python 3.8 | Python 3.9 | Python 3.10 | Python 3.11 | Python 3.12 |
14
+ |----------------------------------|------------|------------|-------------|-------------|-------------|
15
+ | Azure Functions 3.0 (deprecated) | ✔ | ✔ | - | - | - |
16
+ | Azure Functions 4.0 | ✔ | ✔ | ✔ | ✔ | ✔ |
17
+
18
+ For information about Azure Functions Runtime, please refer to [Azure Functions runtime versions overview](https://docs.microsoft.com/en-us/azure/azure-functions/functions-versions) page.
19
+
20
+ ### What's available?
21
+
22
+ - Build, test, debug, and publish using Azure Functions Core Tools (CLI) or Visual Studio Code
23
+ - Deploy Python Function project onto consumption, dedicated, elastic premium, or flex consumption plan.
24
+ - Deploy Python Function project in a custom docker image onto dedicated or elastic premium plan.
25
+ - Triggers / Bindings : Blob, Cosmos DB, Event Grid, Event Hub, HTTP, Kafka, MySQL, Queue, ServiceBus, SQL, Timer, and Warmup
26
+ - Triggers / Bindings : Custom binding support
27
+
28
+ ### What's new?
29
+
30
+ - [SDK Type Bindings for Blob](https://techcommunity.microsoft.com/t5/azure-compute-blog/azure-functions-sdk-type-bindings-for-azure-blob-storage-with/ba-p/4146744)
31
+ - [HTTP Streaming](https://techcommunity.microsoft.com/t5/azure-compute-blog/azure-functions-support-for-http-streams-in-python-is-now-in/ba-p/4146697)
32
+
33
+ ### Get Started
34
+
35
+ - [Create your first Python function](https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-function-python)
36
+ - [Developer guide](https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-python)
37
+ - [Binding API reference](https://docs.microsoft.com/en-us/python/api/azure-functions/azure.functions?view=azure-python)
38
+ - [Develop using VS Code](https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-function-vs-code)
39
+ - [Create a Python Function on Linux using a custom docker image](https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-function-linux-custom-image)
40
+
41
+ # Give Feedback
42
+
43
+ Issues and feature requests are tracked in a variety of places. To report this feedback, please file an issue to the relevant repository below:
44
+
45
+ | Item | Description | Link |
46
+ |---------------|----------------------------------------------|--------------------------------------------------------------------------------|
47
+ | Python Worker | Programming Model, Triggers & Bindings | [File an Issue](https://github.com/Azure/azure-functions-python-worker/issues) |
48
+ | Linux | Base Docker Images | [File an Issue](https://github.com/Azure/azure-functions-docker/issues) |
49
+ | Runtime | Script Host & Language Extensibility | [File an Issue](https://github.com/Azure/azure-functions-host/issues) |
50
+ | VSCode | VSCode Extension for Azure Functions | [File an Issue](https://github.com/microsoft/vscode-azurefunctions/issues) |
51
+ | Core Tools | Command Line Interface for Local Development | [File an Issue](https://github.com/Azure/azure-functions-core-tools/issues) |
52
+ | Portal | User Interface or Experience Issue | [File an Issue](https://github.com/azure/azure-functions-ux/issues) |
53
+ | Templates | Code Issues with Creation Template | [File an Issue](https://github.com/Azure/azure-functions-templates/issues) |
54
+
55
+ # Contribute
56
+
57
+ This project welcomes contributions and suggestions. Most contributions require you to agree to a
58
+ Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
59
+ the rights to use your contribution. For details, visit https://cla.microsoft.com.
60
+
61
+ Here are some pointers to get started:
62
+
63
+ - [Language worker architecture](https://github.com/Azure/azure-functions-python-worker/wiki/Worker-Architecture)
64
+ - [Setting up the development environment](https://github.com/Azure/azure-functions-python-worker/wiki/Contributor-Guide)
65
+ - [Adding support for a new binding](https://github.com/Azure/azure-functions-python-worker/wiki/Adding-support-for-a-new-binding-type)
66
+ - [Release instructions](https://github.com/Azure/azure-functions-python-worker/wiki/Release-Instructions)
67
+
68
+ When you submit a pull request, a CLA-bot will automatically determine whether you need to provide
69
+ a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
70
+ provided by the bot. You will only need to do this once across all repos using our CLA.
71
+
72
+ This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
73
+ For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
74
+ contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
@@ -0,0 +1,159 @@
1
+ Metadata-Version: 2.4
2
+ Name: azure-functions-runtime
3
+ Version: 1.0.0a1
4
+ Summary: Python Language Worker for Azure Functions Runtime
5
+ Author-email: "Azure Functions team at Microsoft Corp." <azurefunctions@microsoft.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) Microsoft Corporation. All rights reserved.
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE
27
+
28
+ Project-URL: Documentation, https://github.com/Azure/azure-functions-python-worker?tab=readme-ov-file#-azure-functions-python-worker
29
+ Project-URL: Repository, https://github.com/Azure/azure-functions-python-worker
30
+ Keywords: azure,functions,azurefunctions,python,serverless
31
+ Classifier: Development Status :: 5 - Production/Stable
32
+ Classifier: Programming Language :: Python
33
+ Classifier: Programming Language :: Python :: 3
34
+ Classifier: Programming Language :: Python :: 3.13
35
+ Classifier: Operating System :: Microsoft :: Windows
36
+ Classifier: Operating System :: POSIX
37
+ Classifier: Operating System :: MacOS :: MacOS X
38
+ Classifier: Environment :: Web Environment
39
+ Classifier: License :: OSI Approved :: MIT License
40
+ Classifier: Intended Audience :: Developers
41
+ Requires-Python: >=3.13
42
+ Description-Content-Type: text/markdown
43
+ License-File: LICENSE
44
+ Requires-Dist: azurefunctions-extensions-base; python_version >= "3.8"
45
+ Requires-Dist: azure-functions
46
+ Provides-Extra: dev
47
+ Requires-Dist: azure-eventhub; extra == "dev"
48
+ Requires-Dist: azure-functions-durable; extra == "dev"
49
+ Requires-Dist: azure-monitor-opentelemetry; python_version >= "3.8" and extra == "dev"
50
+ Requires-Dist: flask; extra == "dev"
51
+ Requires-Dist: fastapi~=0.103.2; extra == "dev"
52
+ Requires-Dist: pydantic; extra == "dev"
53
+ Requires-Dist: pycryptodome==3.*; extra == "dev"
54
+ Requires-Dist: flake8==5.*; python_version == "3.7" and extra == "dev"
55
+ Requires-Dist: flake8==6.*; python_version >= "3.8" and extra == "dev"
56
+ Requires-Dist: mypy; extra == "dev"
57
+ Requires-Dist: pytest; extra == "dev"
58
+ Requires-Dist: requests==2.*; extra == "dev"
59
+ Requires-Dist: coverage; extra == "dev"
60
+ Requires-Dist: grpcio~=1.70.0; extra == "dev"
61
+ Requires-Dist: grpcio-tools~=1.70.0; extra == "dev"
62
+ Requires-Dist: pytest-sugar; extra == "dev"
63
+ Requires-Dist: opentelemetry-api; python_version >= "3.8" and extra == "dev"
64
+ Requires-Dist: pytest-cov; extra == "dev"
65
+ Requires-Dist: pytest-xdist; extra == "dev"
66
+ Requires-Dist: pytest-randomly; extra == "dev"
67
+ Requires-Dist: pytest-instafail; extra == "dev"
68
+ Requires-Dist: pytest-rerunfailures; extra == "dev"
69
+ Requires-Dist: ptvsd; extra == "dev"
70
+ Requires-Dist: python-dotenv; extra == "dev"
71
+ Requires-Dist: plotly; extra == "dev"
72
+ Requires-Dist: scikit-learn; extra == "dev"
73
+ Requires-Dist: opencv-python; extra == "dev"
74
+ Requires-Dist: pandas; extra == "dev"
75
+ Requires-Dist: numpy; extra == "dev"
76
+ Requires-Dist: pre-commit; extra == "dev"
77
+ Requires-Dist: invoke; extra == "dev"
78
+ Provides-Extra: test-http-v2
79
+ Requires-Dist: azurefunctions-extensions-http-fastapi==1.0.0b2; extra == "test-http-v2"
80
+ Requires-Dist: ujson; extra == "test-http-v2"
81
+ Requires-Dist: orjson; extra == "test-http-v2"
82
+ Provides-Extra: test-deferred-bindings
83
+ Requires-Dist: azurefunctions-extensions-bindings-blob==1.0.0b3; extra == "test-deferred-bindings"
84
+ Dynamic: license-file
85
+
86
+ # <img src="https://raw.githubusercontent.com/Azure/azure-functions-python-worker/dev/docs/Azure.Functions.svg" width = "30" alt="Functions Header Image - Lightning Logo"> Azure Functions Python Worker
87
+
88
+ | Branch | Build Status | CodeCov | Test Status |
89
+ |--------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
90
+ | dev | [![Build Status](https://img.shields.io/azure-devops/build/azfunc/public/658/dev)](https://azfunc.visualstudio.com/public/_build/latest?definitionId=658&branchName=dev) | [![codecov](https://codecov.io/gh/Azure/azure-functions-python-worker/branch/dev/graph/badge.svg)](https://codecov.io/gh/Azure/azure-functions-python-worker) | [![Test Status](https://img.shields.io/azure-devops/build/azfunc/public/658/dev)](https://azfunc.visualstudio.com/public/_build/latest?definitionId=658&branchName=dev) |
91
+
92
+ Python support for Azure Functions is based on Python 3.8, 3.9, 3.10, 3.11, and 3.12 serverless hosting on Linux and the Functions 4.0 runtime.
93
+
94
+ Here is the current status of Python in Azure Functions:
95
+
96
+ What are the supported Python versions?
97
+
98
+ | Azure Functions Runtime | Python 3.8 | Python 3.9 | Python 3.10 | Python 3.11 | Python 3.12 |
99
+ |----------------------------------|------------|------------|-------------|-------------|-------------|
100
+ | Azure Functions 3.0 (deprecated) | ✔ | ✔ | - | - | - |
101
+ | Azure Functions 4.0 | ✔ | ✔ | ✔ | ✔ | ✔ |
102
+
103
+ For information about Azure Functions Runtime, please refer to [Azure Functions runtime versions overview](https://docs.microsoft.com/en-us/azure/azure-functions/functions-versions) page.
104
+
105
+ ### What's available?
106
+
107
+ - Build, test, debug, and publish using Azure Functions Core Tools (CLI) or Visual Studio Code
108
+ - Deploy Python Function project onto consumption, dedicated, elastic premium, or flex consumption plan.
109
+ - Deploy Python Function project in a custom docker image onto dedicated or elastic premium plan.
110
+ - Triggers / Bindings : Blob, Cosmos DB, Event Grid, Event Hub, HTTP, Kafka, MySQL, Queue, ServiceBus, SQL, Timer, and Warmup
111
+ - Triggers / Bindings : Custom binding support
112
+
113
+ ### What's new?
114
+
115
+ - [SDK Type Bindings for Blob](https://techcommunity.microsoft.com/t5/azure-compute-blog/azure-functions-sdk-type-bindings-for-azure-blob-storage-with/ba-p/4146744)
116
+ - [HTTP Streaming](https://techcommunity.microsoft.com/t5/azure-compute-blog/azure-functions-support-for-http-streams-in-python-is-now-in/ba-p/4146697)
117
+
118
+ ### Get Started
119
+
120
+ - [Create your first Python function](https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-function-python)
121
+ - [Developer guide](https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-python)
122
+ - [Binding API reference](https://docs.microsoft.com/en-us/python/api/azure-functions/azure.functions?view=azure-python)
123
+ - [Develop using VS Code](https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-function-vs-code)
124
+ - [Create a Python Function on Linux using a custom docker image](https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-function-linux-custom-image)
125
+
126
+ # Give Feedback
127
+
128
+ Issues and feature requests are tracked in a variety of places. To report this feedback, please file an issue to the relevant repository below:
129
+
130
+ | Item | Description | Link |
131
+ |---------------|----------------------------------------------|--------------------------------------------------------------------------------|
132
+ | Python Worker | Programming Model, Triggers & Bindings | [File an Issue](https://github.com/Azure/azure-functions-python-worker/issues) |
133
+ | Linux | Base Docker Images | [File an Issue](https://github.com/Azure/azure-functions-docker/issues) |
134
+ | Runtime | Script Host & Language Extensibility | [File an Issue](https://github.com/Azure/azure-functions-host/issues) |
135
+ | VSCode | VSCode Extension for Azure Functions | [File an Issue](https://github.com/microsoft/vscode-azurefunctions/issues) |
136
+ | Core Tools | Command Line Interface for Local Development | [File an Issue](https://github.com/Azure/azure-functions-core-tools/issues) |
137
+ | Portal | User Interface or Experience Issue | [File an Issue](https://github.com/azure/azure-functions-ux/issues) |
138
+ | Templates | Code Issues with Creation Template | [File an Issue](https://github.com/Azure/azure-functions-templates/issues) |
139
+
140
+ # Contribute
141
+
142
+ This project welcomes contributions and suggestions. Most contributions require you to agree to a
143
+ Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
144
+ the rights to use your contribution. For details, visit https://cla.microsoft.com.
145
+
146
+ Here are some pointers to get started:
147
+
148
+ - [Language worker architecture](https://github.com/Azure/azure-functions-python-worker/wiki/Worker-Architecture)
149
+ - [Setting up the development environment](https://github.com/Azure/azure-functions-python-worker/wiki/Contributor-Guide)
150
+ - [Adding support for a new binding](https://github.com/Azure/azure-functions-python-worker/wiki/Adding-support-for-a-new-binding-type)
151
+ - [Release instructions](https://github.com/Azure/azure-functions-python-worker/wiki/Release-Instructions)
152
+
153
+ When you submit a pull request, a CLA-bot will automatically determine whether you need to provide
154
+ a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
155
+ provided by the bot. You will only need to do this once across all repos using our CLA.
156
+
157
+ This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
158
+ For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
159
+ contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
@@ -0,0 +1,53 @@
1
+ LICENSE
2
+ MANIFEST.in
3
+ README.md
4
+ pyproject.toml
5
+ setup.cfg
6
+ azure_functions_runtime.egg-info/PKG-INFO
7
+ azure_functions_runtime.egg-info/SOURCES.txt
8
+ azure_functions_runtime.egg-info/dependency_links.txt
9
+ azure_functions_runtime.egg-info/requires.txt
10
+ azure_functions_runtime.egg-info/top_level.txt
11
+ azure_functions_worker_v2/__init__.py
12
+ azure_functions_worker_v2/functions.py
13
+ azure_functions_worker_v2/handle_event.py
14
+ azure_functions_worker_v2/http_v2.py
15
+ azure_functions_worker_v2/loader.py
16
+ azure_functions_worker_v2/logging.py
17
+ azure_functions_worker_v2/otel.py
18
+ azure_functions_worker_v2/version.py
19
+ azure_functions_worker_v2/bindings/context.py
20
+ azure_functions_worker_v2/bindings/datumdef.py
21
+ azure_functions_worker_v2/bindings/generic.py
22
+ azure_functions_worker_v2/bindings/meta.py
23
+ azure_functions_worker_v2/bindings/nullable_converters.py
24
+ azure_functions_worker_v2/bindings/out.py
25
+ azure_functions_worker_v2/bindings/retrycontext.py
26
+ azure_functions_worker_v2/bindings/tracecontext.py
27
+ azure_functions_worker_v2/utils/__init__.py
28
+ azure_functions_worker_v2/utils/app_setting_manager.py
29
+ azure_functions_worker_v2/utils/constants.py
30
+ azure_functions_worker_v2/utils/current.py
31
+ azure_functions_worker_v2/utils/env_state.py
32
+ azure_functions_worker_v2/utils/helpers.py
33
+ azure_functions_worker_v2/utils/tracing.py
34
+ azure_functions_worker_v2/utils/typing_inspect.py
35
+ azure_functions_worker_v2/utils/validators.py
36
+ azure_functions_worker_v2/utils/wrappers.py
37
+ tests/protos/FunctionRpc_pb2.py
38
+ tests/protos/FunctionRpc_pb2_grpc.py
39
+ tests/protos/__init__.py
40
+ tests/protos/identity/ClaimsIdentityRpc_pb2.py
41
+ tests/protos/identity/ClaimsIdentityRpc_pb2_grpc.py
42
+ tests/protos/identity/__init__.py
43
+ tests/protos/shared/NullableTypes_pb2.py
44
+ tests/protos/shared/NullableTypes_pb2_grpc.py
45
+ tests/protos/shared/__init__.py
46
+ tests/unittests/test_code_quality.py
47
+ tests/unittests/test_handle_event.py
48
+ tests/unittests/basic_function/function_app.py
49
+ tests/unittests/indexing_exception_function/function_app.py
50
+ tests/unittests/streaming_function/function_app.py
51
+ tests/utils/__init__.py
52
+ tests/utils/constants.py
53
+ tests/utils/testutils.py
@@ -0,0 +1,49 @@
1
+ azure-functions
2
+
3
+ [:python_version >= "3.8"]
4
+ azurefunctions-extensions-base
5
+
6
+ [dev]
7
+ azure-eventhub
8
+ azure-functions-durable
9
+ flask
10
+ fastapi~=0.103.2
11
+ pydantic
12
+ pycryptodome==3.*
13
+ mypy
14
+ pytest
15
+ requests==2.*
16
+ coverage
17
+ grpcio~=1.70.0
18
+ grpcio-tools~=1.70.0
19
+ pytest-sugar
20
+ pytest-cov
21
+ pytest-xdist
22
+ pytest-randomly
23
+ pytest-instafail
24
+ pytest-rerunfailures
25
+ ptvsd
26
+ python-dotenv
27
+ plotly
28
+ scikit-learn
29
+ opencv-python
30
+ pandas
31
+ numpy
32
+ pre-commit
33
+ invoke
34
+
35
+ [dev:python_version == "3.7"]
36
+ flake8==5.*
37
+
38
+ [dev:python_version >= "3.8"]
39
+ azure-monitor-opentelemetry
40
+ flake8==6.*
41
+ opentelemetry-api
42
+
43
+ [test-deferred-bindings]
44
+ azurefunctions-extensions-bindings-blob==1.0.0b3
45
+
46
+ [test-http-v2]
47
+ azurefunctions-extensions-http-fastapi==1.0.0b2
48
+ ujson
49
+ orjson
@@ -0,0 +1,5 @@
1
+ azure_functions_worker_v2
2
+ build
3
+ dist
4
+ eng
5
+ tests
@@ -0,0 +1,14 @@
1
+ # Copyright (c) Microsoft Corporation. All rights reserved.
2
+ # Licensed under the MIT License.
3
+
4
+ from .handle_event import (worker_init_request,
5
+ functions_metadata_request,
6
+ function_environment_reload_request,
7
+ invocation_request,
8
+ function_load_request)
9
+
10
+ __all__ = ('worker_init_request',
11
+ 'functions_metadata_request',
12
+ 'function_environment_reload_request',
13
+ 'invocation_request',
14
+ 'function_load_request')
@@ -0,0 +1,67 @@
1
+ # Copyright (c) Microsoft Corporation. All rights reserved.
2
+ # Licensed under the MIT License.
3
+ import threading
4
+ from typing import Type
5
+
6
+ from .retrycontext import RetryContext
7
+ from .tracecontext import TraceContext
8
+
9
+
10
+ class Context:
11
+ def __init__(self,
12
+ func_name: str,
13
+ func_dir: str,
14
+ invocation_id: str,
15
+ thread_local_storage: Type[threading.local],
16
+ trace_context: TraceContext,
17
+ retry_context: RetryContext) -> None:
18
+ self.__func_name = func_name
19
+ self.__func_dir = func_dir
20
+ self.__invocation_id = invocation_id
21
+ self.__thread_local_storage = thread_local_storage
22
+ self.__trace_context = trace_context
23
+ self.__retry_context = retry_context
24
+
25
+ @property
26
+ def invocation_id(self) -> str:
27
+ return self.__invocation_id
28
+
29
+ @property
30
+ def thread_local_storage(self) -> Type[threading.local]:
31
+ return self.__thread_local_storage
32
+
33
+ @property
34
+ def function_name(self) -> str:
35
+ return self.__func_name
36
+
37
+ @property
38
+ def function_directory(self) -> str:
39
+ return self.__func_dir
40
+
41
+ @property
42
+ def trace_context(self) -> TraceContext:
43
+ return self.__trace_context
44
+
45
+ @property
46
+ def retry_context(self) -> RetryContext:
47
+ return self.__retry_context
48
+
49
+
50
+ def get_context(invoc_request, name: str,
51
+ directory: str) -> Context:
52
+ """ For more information refer:
53
+ https://aka.ms/azfunc-invocation-context
54
+ """
55
+ trace_context = TraceContext(
56
+ invoc_request.trace_context.trace_parent,
57
+ invoc_request.trace_context.trace_state,
58
+ invoc_request.trace_context.attributes)
59
+
60
+ retry_context = RetryContext(
61
+ invoc_request.retry_context.retry_count,
62
+ invoc_request.retry_context.max_retry_count,
63
+ invoc_request.retry_context.exception)
64
+
65
+ return Context(
66
+ name, directory, invoc_request.invocation_id,
67
+ threading.local(), trace_context, retry_context)