Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .ci/e2e_integration_test/start-e2e.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ Write-Host "--------------------------------------------------------------------
Write-Host "Preparing E2E integration tests..." -ForegroundColor Green
Write-Host "-----------------------------------------------------------------------------`n" -ForegroundColor Green
python -m pip install -U pip
python -m pip install -U -e .[dev]
cd tests
python -m pip install -U -e workers/[dev]
cd workers/tests
python -m invoke -c test_setup build-protos
python -m invoke -c test_setup extensions
Write-Host "-----------------------------------------------------------------------------`n" -ForegroundColor Green
Expand Down
37 changes: 28 additions & 9 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,33 @@ This checklist is used to make sure that common issues in a pull request are add
This will expedite the process of getting your pull request merged and avoid extra work on your part to fix issues discovered during the review process.
-->

### PR information
<!-- You can mark the following checkboxes as [x] to mark them during the PR creation itself. -->
- [ ] The title of the PR is clear and informative.
- [ ] There are a small number of commits, each of which has an informative message. This means that previously merged commits do not appear in the history of the PR. For information on cleaning up the commits in your pull request, [see this page](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md).
- [ ] If applicable, the PR references the bug/issue that it fixes in the description.
- [ ] New Unit tests were added for the changes made and CI is passing.

### Quality of Code and Contribution Guidelines
- [ ] I have read the [contribution guidelines](https://github.com/Azure/azure-functions-python-worker/blob/master/.github/CONTRIBUTING.md).
## Pull Request Checklist
<!--
Please fill out the following checklist to ensure compatibility across Python versions and programming models.
You can mark the following checkboxes as [x] to mark them during the PR creation itself.
-->
### Host-Worker Contract
- [ ] Does this PR impact the host-worker contract (e.g., gRPC messages, shared interfaces)?
- If yes, have the changes been applied to:
- [ ] azure_functions_worker (Python <= 3.12)
- [ ] proxy_worker (Python >= 3.13)
- If no, please explain why:

### Worker Execution Logic
- [ ] Does this PR affect worker execution logic (e.g., function invocation, bindings, lifecycle)?
If yes, please answer the following:

**Python Version Coverage**
- [ ] Does this change apply to both Python <=3.12 and 3.13+?
- If yes, have the changes been made to:
- [ ] azure_functions_worker (Python <= 3.12)
- [ ] azure_functions_worker_v1 / azure_functions_worker_v2 (Python >= 3.13)
- If no, please explain why:

**Programming Model Compatibility (for Python 3.13+)**
- Does this change apply to both:
- [ ] V1 programming model (azure_functions_worker_v1)?
- [ ] V2 programming model (azure_functions_worker_v2)?
- Explanation (if limited to one model):

<!-- Thanks for using the checklist -->
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ py3env/
*.nupkg

.testconfig
*/.testconfig
.pytest_cache

# vscode
Expand Down
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@
|--------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 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) |

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.
Python support for Azure Functions is based on Python 3.10, 3.11, 3.12, and 3.13 serverless hosting on Linux and the Functions 4.0 runtime.

Here is the current status of Python in Azure Functions:

What are the supported Python versions?

| Azure Functions Runtime | Python 3.8 | Python 3.9 | Python 3.10 | Python 3.11 | Python 3.12 |
|----------------------------------|------------|------------|-------------|-------------|-------------|
| Azure Functions 3.0 (deprecated) | ✔ | ✔ | - | - | - |
| Azure Functions 4.0 | ✔ | ✔ | ✔ | ✔ | ✔ |
| Azure Functions Runtime | Python 3.10 | Python 3.11 | Python 3.12 | Python 3.13 |
|----------------------------------|------------|------------|-------------|-------------|
| Azure Functions 4.0 | ✔ | ✔ | ✔ | ✔ |

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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<file src="..\..\3.13_OSX_X64\**" target="tools\3.13\OSX\X64" />
<file src="..\..\3.13_OSX_ARM64\**" target="tools\3.13\OSX\Arm64" />
<file src="..\..\3.13_LINUX_ARM64\**" target="tools\3.13\LINUX\Arm64" />
<file src="..\..\python\prodV4\worker.config.json" target="tools" />
<file src="..\..\workers\python\prodV4\worker.config.json" target="tools" />
<file src="Microsoft.Azure.Functions.PythonWorker.targets" target="build" />
<file src="..\..\_manifest\spdx_2.2\manifest.spdx.json" target="SBOM\manifest.spdx.json" />
</files>
Expand Down
1 change: 1 addition & 0 deletions eng/pack/scripts/mac_arm64_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ python -m venv .env
source .env/bin/activate
python -m pip install --upgrade pip

cd workers
python -m pip install .
python -m pip install . --no-compile --target "$BUILD_SOURCESDIRECTORY/deps"

Expand Down
3 changes: 3 additions & 0 deletions eng/pack/scripts/nix_arm64_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ docker run --name my-arm64-container --platform linux/arm64 \
ls -la /src # debug: see what files exist
apt-get update && apt-get install -y git curl && \
pip install --upgrade pip && \
cd workers && \
pip install . && \
pip install . --target /src && \
pip install invoke && \
Expand All @@ -29,6 +30,8 @@ docker run --name my-arm64-container --platform linux/arm64 \
ls -la /src
"

cd workers

# This copies over the build files from the docker container to the local pipeline
docker cp my-arm64-container:/src/. $BUILD_SOURCESDIRECTORY/all/
docker rm my-arm64-container
Expand Down
1 change: 1 addition & 0 deletions eng/pack/scripts/nix_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ python -m venv .env
source .env/bin/activate
python -m pip install --upgrade pip

cd workers
python -m pip install .
python -m pip install . --no-compile --target "$BUILD_SOURCESDIRECTORY/deps"

Expand Down
1 change: 1 addition & 0 deletions eng/pack/scripts/win_deps.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ python -m venv .env
.env\Scripts\Activate.ps1
python -m pip install --upgrade pip

cd workers
python -m pip install .

$depsPath = Join-Path -Path $env:BUILD_SOURCESDIRECTORY -ChildPath "deps"
Expand Down
1 change: 1 addition & 0 deletions eng/pack/templates/macos_64_env_gen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ steps:
displayName: 'Install Dependencies'
- bash: |
pip install pip-audit
cd workers
pip-audit -r requirements.txt
displayName: 'Run vulnerability scan'
condition: ne(variables['pythonVersion'], '3.7')
Expand Down
1 change: 1 addition & 0 deletions eng/pack/templates/nix_arm64_env_gen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ steps:
displayName: 'Install Dependencies'
- bash: |
pip install pip-audit
cd workers
pip-audit -r requirements.txt
displayName: 'Run vulnerability scan'
condition: ne(variables['pythonVersion'], '3.7')
Expand Down
1 change: 1 addition & 0 deletions eng/pack/templates/nix_env_gen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ steps:
displayName: 'Install Dependencies'
- bash: |
pip install pip-audit
cd workers
pip-audit -r requirements.txt
displayName: 'Run vulnerability scan'
condition: ne(variables['pythonVersion'], '3.7')
Expand Down
1 change: 1 addition & 0 deletions eng/pack/templates/win_env_gen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ steps:
arguments: '${{ parameters.pythonVersion }}'
- bash: |
pip install pip-audit
cd workers
pip-audit -r requirements.txt
displayName: 'Run vulnerability scan'
condition: ne(variables['pythonVersion'], '3.7')
Expand Down
8 changes: 4 additions & 4 deletions eng/scripts/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

python -m pip install --upgrade pip
python -m pip install -U azure-functions --pre
python -m pip install -U -e .[dev]
python -m pip install -U -e workers/[dev]

if [[ $1 != "3.7" ]]; then
python -m pip install --pre -U -e .[test-http-v2]
python -m pip install --pre -U -e workers/[test-http-v2]
fi
if [[ $1 != "3.7" && $1 != "3.8" ]]; then
python -m pip install --pre -U -e .[test-deferred-bindings]
fi
python -m pip install --pre -U -e workers/[test-deferred-bindings]
fi
1 change: 1 addition & 0 deletions eng/scripts/test-extensions.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash

cd workers
python -m pip install --upgrade pip
if [[ $2 != "3.7" ]]; then
python -m pip install -e $1/PythonExtensionArtifact/$3
Expand Down
1 change: 1 addition & 0 deletions eng/scripts/test-sdk.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash

cd workers
python -m pip install --upgrade pip
python -m pip install -e $1/PythonSdkArtifact
python -m pip install -e .[dev]
Expand Down
2 changes: 1 addition & 1 deletion eng/scripts/test-setup.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

cd tests
cd workers/tests
python -m invoke -c test_setup build-protos
python -m invoke -c test_setup webhost --branch-name=dev
python -m invoke -c test_setup extensions
2 changes: 2 additions & 0 deletions eng/templates/jobs/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ jobs:
python -m venv .env
.env\Scripts\Activate.ps1
python -m pip install --upgrade pip
cd workers
python -m pip install .
displayName: 'Build python worker'
- bash: |
pip install pip-audit
cd workers
pip-audit -r requirements.txt
displayName: 'Run vulnerability scan'
10 changes: 6 additions & 4 deletions eng/templates/jobs/ci-emulator-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,22 @@ jobs:
displayName: 'Install test python extension, dependencies and the worker'
condition: or(eq(variables.isExtensionsRelease, true), eq(variables['USETESTPYTHONEXTENSIONS'], true))
- bash: |
docker compose -f tests/emulator_tests/utils/eventhub/docker-compose.yml pull
docker compose -f tests/emulator_tests/utils/eventhub/docker-compose.yml up -d
docker compose -f workers/tests/emulator_tests/utils/eventhub/docker-compose.yml pull
docker compose -f workers/tests/emulator_tests/utils/eventhub/docker-compose.yml up -d
displayName: 'Install Azurite and Start EventHub Emulator'
- bash: |
python -m pytest -q -n auto --dist loadfile --reruns 4 --ignore=tests/emulator_tests/test_servicebus_functions.py tests/emulator_tests
env:
AzureWebJobsStorage: "UseDevelopmentStorage=true"
AzureWebJobsEventHubConnectionString: "Endpoint=sb://localhost;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=SAS_KEY_VALUE;UseDevelopmentEmulator=true;"
workingDirectory: $(Build.SourcesDirectory)/workers
displayName: "Running $(PYTHON_VERSION) Python Linux Emulator Tests"
- bash: |
# Stop and remove EventHub Emulator container to free up the port
docker stop eventhubs-emulator
docker container rm --force eventhubs-emulator
docker compose -f tests/emulator_tests/utils/servicebus/docker-compose.yml pull
docker compose -f tests/emulator_tests/utils/servicebus/docker-compose.yml up -d
docker compose -f workers/tests/emulator_tests/utils/servicebus/docker-compose.yml pull
docker compose -f workers/tests/emulator_tests/utils/servicebus/docker-compose.yml up -d
env:
AzureWebJobsSQLPassword: $(AzureWebJobsSQLPassword)
displayName: 'Install Azurite and Start ServiceBus Emulator'
Expand All @@ -99,4 +100,5 @@ jobs:
env:
AzureWebJobsStorage: "UseDevelopmentStorage=true"
AzureWebJobsServiceBusConnectionString: "Endpoint=sb://localhost;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=SAS_KEY_VALUE;UseDevelopmentEmulator=true;"
workingDirectory: $(Build.SourcesDirectory)/workers
displayName: "Running $(PYTHON_VERSION) Python ServiceBus Linux Emulator Tests"
1 change: 1 addition & 0 deletions eng/templates/jobs/ci-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,5 @@ jobs:
condition: and(eq(variables.isSdkRelease, false), eq(variables.isExtensionsRelease, false), eq(variables['USETESTPYTHONSDK'], false), eq(variables['USETESTPYTHONEXTENSIONS'], false))
env:
PYTHON_VERSION: $(PYTHON_VERSION)
workingDirectory: $(Build.SourcesDirectory)/workers

2 changes: 1 addition & 1 deletion eng/templates/official/jobs/build-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ jobs:
elif [[ $BUILD_SOURCEBRANCHNAME = dev ]]
then
echo "Generating V4 Integration Test Package for $BUILD_SOURCEBRANCHNAME"
VERSION=$(cat azure_functions_worker/version.py | tail -1 | cut -d' ' -f3 | sed "s/'//g")
VERSION=$(cat workers/azure_functions_worker/version.py | tail -1 | cut -d' ' -f3 | sed "s/'//g")
NUSPEC="eng\pack\Microsoft.Azure.Functions.V4.PythonWorker.nuspec"
WKVERSION="$VERSION-$(Build.BuildNumber)"
else
Expand Down
3 changes: 2 additions & 1 deletion eng/templates/official/jobs/ci-custom-image-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
chmod +x eng/scripts/install-dependencies.sh

eng/scripts/install-dependencies.sh $(PYTHON_VERSION)
cd tests
cd workers/tests
python -m invoke -c test_setup build-protos
displayName: 'Install dependencies'
- bash: |
Expand All @@ -31,4 +31,5 @@ jobs:
AzureWebJobsSqlConnectionString: $(LinuxSqlConnectionString311)
AzureWebJobsEventGridTopicUri: $(LinuxEventGridTopicUriString311)
AzureWebJobsEventGridConnectionKey: $(LinuxEventGridConnectionKeyString311)
workingDirectory: $(Build.SourcesDirectory)/workers
displayName: "Running Python DockerCustom tests"
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
chmod +x eng/scripts/install-dependencies.sh

eng/scripts/install-dependencies.sh $(PYTHON_VERSION)
cd tests
cd workers/tests
python -m invoke -c test_setup build-protos
displayName: 'Install dependencies'
- bash: |
Expand All @@ -68,4 +68,5 @@ jobs:
AzureWebJobsSqlConnectionString: $(SQL_CONNECTION)
AzureWebJobsEventGridTopicUri: $(EVENTGRID_URI)
AzureWebJobsEventGridConnectionKey: $(EVENTGRID_CONNECTION)
workingDirectory: $(Build.SourcesDirectory)/workers
displayName: "Running $(PYTHON_VERSION) Docker Consumption tests"
3 changes: 2 additions & 1 deletion eng/templates/official/jobs/ci-docker-dedicated-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
chmod +x eng/scripts/install-dependencies.sh

eng/scripts/install-dependencies.sh $(PYTHON_VERSION)
cd tests
cd workers/tests
python -m invoke -c test_setup build-protos
displayName: 'Install dependencies'
- bash: |
Expand All @@ -68,4 +68,5 @@ jobs:
AzureWebJobsSqlConnectionString: $(SQL_CONNECTION)
AzureWebJobsEventGridTopicUri: $(EVENTGRID_URI)
AzureWebJobsEventGridConnectionKey: $(EVENTGRID_CONNECTION)
workingDirectory: $(Build.SourcesDirectory)/workers
displayName: "Running $(PYTHON_VERSION) Docker Dedicated tests"
1 change: 1 addition & 0 deletions eng/templates/official/jobs/ci-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,4 @@ jobs:
skipTest: $(skipTest)
PYAZURE_WEBHOST_DEBUG: true
displayName: "Running $(PYTHON_VERSION) Python E2E Tests"
workingDirectory: $(Build.SourcesDirectory)/workers
3 changes: 2 additions & 1 deletion eng/templates/official/jobs/ci-lc-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
python -m pip install --upgrade pip
python -m pip install -U -e .[dev]

cd tests
cd workers/tests
python -m invoke -c test_setup build-protos
displayName: 'Install dependencies and the worker'
# Skip the installation stage for SDK and Extensions release branches. This stage will fail because pyproject.toml contains the updated (and unreleased) library version
Expand All @@ -39,4 +39,5 @@ jobs:
AzureWebJobsStorage: $(LinuxStorageConnectionString312)
_DUMMY_CONT_KEY: $(_DUMMY_CONT_KEY)
displayName: "Running $(PYTHON_VERSION) Linux Consumption tests"
workingDirectory: $(Build.SourcesDirectory)/workers
condition: and(eq(variables.isSdkRelease, false), eq(variables.isExtensionsRelease, false), eq(variables['USETESTPYTHONSDK'], false), eq(variables['USETESTPYTHONEXTENSIONS'], false))
Loading
Loading