Skip to content

Commit 9ff0466

Browse files
committed
initial commit
1 parent ed4e08e commit 9ff0466

File tree

707 files changed

+1587
-35509
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

707 files changed

+1587
-35509
lines changed

.artifactignore

Lines changed: 0 additions & 7 deletions
This file was deleted.

.ci/e2e_integration_test/start-e2e.ps1

Lines changed: 0 additions & 102 deletions
This file was deleted.

.devcontainer/Dockerfile

Lines changed: 0 additions & 21 deletions
This file was deleted.

.devcontainer/devcontainer.json

Lines changed: 0 additions & 57 deletions
This file was deleted.

.flake8

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ exclude = .git, __pycache__, build, dist, .eggs, .github, .local, docs/,
1010
azure_functions_worker/_thirdparty/typing_inspect.py,
1111
tests/unittests/test_typing_inspect.py,
1212
tests/unittests/broken_functions/syntax_error/main.py,
13+
tests/protos/,
1314
.env*, .vscode, venv*, *.venv*
1415

1516
max-line-length = 88

CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
# For all file changes, github would automatically
1111
# include the following people in the PRs.
1212

13-
* @vrdmr @gavin-aguiar @hallvictoria
13+
* @vrdmr @gavin-aguiar @YunchuWang @pdthummar @hallvictoria

README.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,35 @@
11
# <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
22

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) |
3+
| Branch | Status | CodeCov | Unittests | E2E tests |
4+
|--------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------|
5+
| main | [![Build Status](https://azfunc.visualstudio.com/Azure%20Functions/_apis/build/status/Azure.azure-functions-python-worker?branchName=main)](https://azfunc.visualstudio.com/Azure%20Functions/_build/latest?definitionId=57&branchName=main) | [![codecov](https://codecov.io/gh/Azure/azure-functions-python-worker/branch/main/graph/badge.svg)](https://codecov.io/gh/Azure/azure-functions-python-worker) | ![CI Unit tests](https://github.com/Azure/azure-functions-python-worker/workflows/CI%20Unit%20tests/badge.svg?branch=main) | ![CI E2E tests](https://github.com/Azure/azure-functions-python-worker/workflows/CI%20E2E%20tests/badge.svg?branch=main) |
6+
| dev | [![Build Status](https://azfunc.visualstudio.com/Azure%20Functions/_apis/build/status/Azure.azure-functions-python-worker?branchName=dev)](https://azfunc.visualstudio.com/Azure%20Functions/_build/latest?definitionId=57&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) | ![CI Unit tests](https://github.com/Azure/azure-functions-python-worker/workflows/CI%20Unit%20tests/badge.svg?branch=dev) | ![CI E2E tests](https://github.com/Azure/azure-functions-python-worker/workflows/CI%20E2E%20tests/badge.svg?branch=dev) |
67

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+
Python support for Azure Functions is based on Python 3.6, 3.7, 3.8, 3.9, and 3.10 serverless hosting on Linux and the Functions 2.0, 3.0 and 4.0 runtime.
89

910
Here is the current status of Python in Azure Functions:
1011

1112
What are the supported Python versions?
1213

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 ||||||
14+
| Azure Functions Runtime | Python 3.6 | Python 3.7 | Python 3.8 | Python 3.9 | Python 3.10 | Python 3.11 |
15+
|----------------------------------|------------|------------|------------|------------|-------------|-------------|
16+
| Azure Functions 2.0 (deprecated) ||| - | - | - | - |
17+
| Azure Functions 3.0 (deprecated) ||||| - | - |
18+
| Azure Functions 4.0 | - | - |||||
1719

1820
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.
1921

2022
### What's available?
2123

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
24+
- Build, test, debug and publish using Azure Functions Core Tools (CLI) or Visual Studio Code
25+
- Deploy Python Function project onto consumption, dedicated, or elastic premium plan.
26+
- Deploy Python Function project in a custom docker image onto dedicated, or elastic premium plan.
27+
- Triggers / Bindings : HTTP, Blob, Queue, Timer, Cosmos DB, Event Grid, Event Hubs and Service Bus
2628
- Triggers / Bindings : Custom binding support
2729

28-
### What's new?
30+
What's coming?
2931

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+
- [Durable Functions For Python](https://github.com/Azure/azure-functions-durable-python)
3233

3334
### Get Started
3435

@@ -71,4 +72,4 @@ provided by the bot. You will only need to do this once across all repos using o
7172

7273
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
7374
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
74-
contact [[email protected]](mailto:[email protected]) with any additional questions or comments.
75+
contact [[email protected]](mailto:[email protected]) with any additional questions or comments.

azure_functions_worker/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
# Copyright (c) Microsoft Corporation. All rights reserved.
22
# Licensed under the MIT License.
3+
4+
from .handle_event import worker_init_request, functions_metadata_request, function_environment_reload_request, invocation_request, functions_load_request
5+
6+
__all__ = ('worker_init_request', 'functions_metadata_request', 'function_environment_reload_request', 'invocation_request', 'functions_load_request')

azure_functions_worker/__main__.py

Lines changed: 0 additions & 6 deletions
This file was deleted.

azure_functions_worker/bindings/__init__.py

Lines changed: 0 additions & 29 deletions
This file was deleted.

azure_functions_worker/bindings/context.py

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
# Copyright (c) Microsoft Corporation. All rights reserved.
22
# Licensed under the MIT License.
3+
34
import threading
5+
46
from typing import Type
57

6-
from . import RetryContext, TraceContext
8+
from .retrycontext import RetryContext
9+
from .tracecontext import TraceContext
710

811

912
class Context:
10-
1113
def __init__(self,
1214
func_name: str,
1315
func_dir: str,
@@ -45,3 +47,23 @@ def trace_context(self) -> TraceContext:
4547
@property
4648
def retry_context(self) -> RetryContext:
4749
return self.__retry_context
50+
51+
52+
def get_context(invoc_request, name: str,
53+
directory: str) -> Context:
54+
""" For more information refer:
55+
https://aka.ms/azfunc-invocation-context
56+
"""
57+
trace_context = TraceContext(
58+
invoc_request.trace_context.trace_parent,
59+
invoc_request.trace_context.trace_state,
60+
invoc_request.trace_context.attributes)
61+
62+
retry_context = RetryContext(
63+
invoc_request.retry_context.retry_count,
64+
invoc_request.retry_context.max_retry_count,
65+
invoc_request.retry_context.exception)
66+
67+
return Context(
68+
name, directory, invoc_request.invocation_id,
69+
threading.local(), trace_context, retry_context)

0 commit comments

Comments
 (0)