Skip to content

Commit 18aafe9

Browse files
authored
Enabling Python 3.10 CI and other changes (#961)
* Removing loop in Queue and fixing Python version test * Updating the workflow files for 3.10 CI * Updating Prod V4 info * Enabling UTs to run for any Push * Correcting the test skip for DI * Updating readme.md for Python 3.10 * Skipping LC E2E tests for 3.10 * Bumping up EH version * nit changes to use is_python_version and bumping up versions * Resolving flake8 issues
1 parent 5e522fc commit 18aafe9

File tree

16 files changed

+60
-41
lines changed

16 files changed

+60
-41
lines changed

.github/workflows/ci_e2e_workflow.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
strategy:
2222
fail-fast: false
2323
matrix:
24-
python-version: [ 3.6, 3.7, 3.8, 3.9 ]
24+
python-version: [ 3.6, 3.7, 3.8, 3.9, "3.10" ]
2525

2626
steps:
2727
- name: Checkout code.
@@ -113,6 +113,17 @@ jobs:
113113
AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString39 }}
114114
run: |
115115
pytest --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend
116+
- name: Running 3.10 Tests
117+
if: matrix.python-version == 3.10
118+
env:
119+
AzureWebJobsStorage: ${{ secrets.LinuxStorageConnectionString310 }}
120+
AzureWebJobsCosmosDBConnectionString: ${{ secrets.LinuxCosmosDBConnectionString310 }}
121+
AzureWebJobsEventHubConnectionString: ${{ secrets.LinuxEventHubConnectionString310 }}
122+
AzureWebJobsServiceBusConnectionString: ${{ secrets.LinuxServiceBusConnectionString310 }}
123+
AzureWebJobsEventGridTopicUri: ${{ secrets.LinuxEventGridTopicUriString310 }}
124+
AzureWebJobsEventGridConnectionKey: ${{ secrets.LinuxEventGridConnectionKeyString310 }}
125+
run: |
126+
pytest --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend
116127
- name: Codecov
117128
uses: codecov/[email protected]
118129
with:

.github/workflows/ut_ci_workflow.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
name: CI Unit tests
55

66
on:
7+
workflow_dispatch:
78
schedule:
89
# Monday to Thursday 1 AM PDT build
910
# * is a special character in YAML so you have to quote this string
1011
- cron: "0 8 * * 1,2,3,4"
1112
push:
12-
branches: [ dev, master, main, release/* ]
1313
pull_request:
1414
branches: [ dev, master, main, release/* ]
1515

@@ -20,7 +20,7 @@ jobs:
2020
strategy:
2121
fail-fast: true
2222
matrix:
23-
python-version: [ 3.6, 3.7, 3.8, 3.9 ]
23+
python-version: [ 3.6, 3.7, 3.8, 3.9, "3.10" ]
2424
steps:
2525
- uses: actions/checkout@v2
2626
- name: Set up Python ${{ matrix.python-version }}

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
|master|[![Build Status](https://azfunc.visualstudio.com/Azure%20Functions/_apis/build/status/Azure.azure-functions-python-worker?branchName=master)](https://azfunc.visualstudio.com/Azure%20Functions/_build/latest?definitionId=57&branchName=master)|[![codecov](https://codecov.io/gh/Azure/azure-functions-python-worker/branch/master/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=master)|![CI E2E tests](https://github.com/Azure/azure-functions-python-worker/workflows/CI%20E2E%20tests/badge.svg?branch=master)
66
|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)
77

8-
Python support for Azure Functions is based on Python 3.6, Python 3.7, Python 3.8, and Python 3.9 serverless hosting on Linux and the Functions 2.0, 3.0 and 4.0 runtime.
8+
Python support for Azure Functions is based on Python 3.6, Python 3.7, Python 3.8, Python 3.9, and Python 3.10 serverless hosting on Linux and the Functions 2.0, 3.0 and 4.0 runtime.
99

1010
Here is the current status of Python in Azure Functions:
1111

1212
What are the supported Python versions?
1313

14-
|Azure Functions Runtime|Python 3.6|Python 3.7|Python 3.8|Python 3.9|
15-
|---|---|---|---|---|
16-
|Azure Functions 2.0|||-|-|
17-
|Azure Functions 3.0|||||
18-
|Azure Functions 4.0|-||||
14+
|Azure Functions Runtime|Python 3.6|Python 3.7|Python 3.8|Python 3.9|Python 3.10|
15+
|---|---|---|---|---|---|
16+
|Azure Functions 2.0|||-|-|-|
17+
|Azure Functions 3.0|||||-|
18+
|Azure Functions 4.0|-||||preview|
1919

2020
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.
2121

azure_functions_worker/testutils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ def __init__(self, loop, scripts_dir):
466466

467467
self._connected_fut = loop.create_future()
468468
self._in_queue = queue.Queue()
469-
self._out_aqueue = asyncio.Queue(loop=self._loop)
469+
self._out_aqueue = asyncio.Queue()
470470
self._threadpool = concurrent.futures.ThreadPoolExecutor(max_workers=1)
471471
self._server = grpc.server(self._threadpool)
472472
self._servicer = _MockWebHostServicer(self)

python/prodV4/worker.config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"language":"python",
44
"defaultRuntimeVersion":"3.9",
55
"supportedOperatingSystems":["LINUX", "OSX", "WINDOWS"],
6-
"supportedRuntimeVersions":["3.7", "3.8", "3.9"],
6+
"supportedRuntimeVersions":["3.7", "3.8", "3.9", "3.10"],
77
"supportedArchitectures":["X64", "X86"],
88
"extensions":[".py"],
99
"defaultExecutablePath":"python",

python/prodV4/worker.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ def determine_user_pkg_paths():
3838

3939
home = Path.home()
4040
pkgs_path = os.path.join(home, PKGS_PATH)
41-
user_pkg_paths = []
41+
usr_packages_path = []
4242

43-
if minor_version in (7, 8, 9):
44-
user_pkg_paths.append(os.path.join(pkgs_path, PKGS))
43+
if minor_version in (7, 8, 9, 10):
44+
usr_packages_path.append(os.path.join(pkgs_path, PKGS))
4545
else:
4646
raise RuntimeError(f'Unsupported Python version: 3.{minor_version}')
4747

48-
return user_pkg_paths
48+
return usr_packages_path
4949

5050

5151
if __name__ == '__main__':

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@
114114

115115
EXTRA_REQUIRES = {
116116
"dev": [
117-
"azure-eventhub~=5.1.0",
118-
"python-dateutil~=2.8.1",
117+
"azure-eventhub~=5.7.0", # Used for EventHub E2E tests
118+
"python-dateutil~=2.8.2",
119119
"pycryptodome~=3.10.1",
120-
"flake8~=3.7.9",
120+
"flake8~=4.0.1",
121121
"mypy",
122122
"pytest",
123123
"requests==2.*",

tests/endtoend/eventhub_batch_functions/metadata_output_batch/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ def main(req: func.HttpRequest):
3333
with client:
3434
client.send_batch(event_data_batch)
3535

36-
return f'OK'
36+
return 'OK'

tests/endtoend/eventhub_functions/metadata_output/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ async def main(req: func.HttpRequest):
3232
finally:
3333
await client.close()
3434

35-
return f'OK'
35+
return 'OK'

tests/endtoend/test_linux_consumption.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Copyright (c) Microsoft Corporation. All rights reserved.
22
# Licensed under the MIT License.
3-
from unittest import TestCase
3+
from unittest import TestCase, skipIf
44

55
import os
66
import sys
@@ -9,8 +9,12 @@
99
from azure_functions_worker.testutils_lc import (
1010
LinuxConsumptionWebHostController
1111
)
12+
from azure_functions_worker.utils.common import is_python_version
1213

1314

15+
@skipIf(is_python_version('3.10'),
16+
"Skip the tests for Python 3.10 currently as the mesh images for "
17+
"Python 3.10 aren't available currently.")
1418
class TestLinuxConsumption(TestCase):
1519
"""Test worker behaviors on specific scenarios.
1620

0 commit comments

Comments
 (0)