diff --git a/eng/templates/jobs/ci-unit-tests.yml b/eng/templates/jobs/ci-unit-tests.yml index f91a550a8..cf31f94f6 100644 --- a/eng/templates/jobs/ci-unit-tests.yml +++ b/eng/templates/jobs/ci-unit-tests.yml @@ -14,6 +14,8 @@ jobs: PYTHON_VERSION: '3.10' Python311: PYTHON_VERSION: '3.11' + Python312: + PYTHON_VERSION: '3.12' steps: - task: UsePythonVersion@0 diff --git a/eng/templates/official/jobs/build-artifacts.yml b/eng/templates/official/jobs/build-artifacts.yml index 31b1ca23e..afea05cd9 100644 --- a/eng/templates/official/jobs/build-artifacts.yml +++ b/eng/templates/official/jobs/build-artifacts.yml @@ -21,6 +21,9 @@ jobs: Python311V4: pythonVersion: '3.11' workerPath: 'python/prodV4/worker.py' + Python312V4: + pythonVersion: '3.12' + workerPath: 'python/prodV4/worker.py' templateContext: outputParentDirectory: $(Build.ArtifactStagingDirectory) outputs: diff --git a/eng/templates/official/jobs/ci-docker-consumption-tests.yml b/eng/templates/official/jobs/ci-docker-consumption-tests.yml index 56d2e8f67..4fc13d4fb 100644 --- a/eng/templates/official/jobs/ci-docker-consumption-tests.yml +++ b/eng/templates/official/jobs/ci-docker-consumption-tests.yml @@ -45,6 +45,15 @@ jobs: SQL_CONNECTION: $(LinuxSqlConnectionString311) EVENTGRID_URI: $(LinuxEventGridTopicUriString311) EVENTGRID_CONNECTION: $(LinuxEventGridConnectionKeyString311) + Python312: + PYTHON_VERSION: '3.12' + STORAGE_CONNECTION: $(LinuxStorageConnectionString312) + COSMOSDB_CONNECTION: $(LinuxCosmosDBConnectionString312) + EVENTHUB_CONNECTION: $(LinuxEventHubConnectionString312) + SERVICEBUS_CONNECTION: $(LinuxServiceBusConnectionString312) + SQL_CONNECTION: $(LinuxSqlConnectionString312) + EVENTGRID_URI: $(LinuxEventGridTopicUriString312) + EVENTGRID_CONNECTION: $(LinuxEventGridConnectionKeyString312) steps: - task: UsePythonVersion@0 diff --git a/eng/templates/official/jobs/ci-docker-dedicated-tests.yml b/eng/templates/official/jobs/ci-docker-dedicated-tests.yml index 82f44ef82..10f7bdfc7 100644 --- a/eng/templates/official/jobs/ci-docker-dedicated-tests.yml +++ b/eng/templates/official/jobs/ci-docker-dedicated-tests.yml @@ -45,6 +45,15 @@ jobs: SQL_CONNECTION: $(LinuxSqlConnectionString311) EVENTGRID_URI: $(LinuxEventGridTopicUriString311) EVENTGRID_CONNECTION: $(LinuxEventGridConnectionKeyString311) + Python312: + PYTHON_VERSION: '3.12' + STORAGE_CONNECTION: $(LinuxStorageConnectionString312) + COSMOSDB_CONNECTION: $(LinuxCosmosDBConnectionString312) + EVENTHUB_CONNECTION: $(LinuxEventHubConnectionString312) + SERVICEBUS_CONNECTION: $(LinuxServiceBusConnectionString312) + SQL_CONNECTION: $(LinuxSqlConnectionString312) + EVENTGRID_URI: $(LinuxEventGridTopicUriString312) + EVENTGRID_CONNECTION: $(LinuxEventGridConnectionKeyString312) steps: - task: UsePythonVersion@0 diff --git a/eng/templates/official/jobs/ci-e2e-tests.yml b/eng/templates/official/jobs/ci-e2e-tests.yml index 25c5d9453..d1dbc04b7 100644 --- a/eng/templates/official/jobs/ci-e2e-tests.yml +++ b/eng/templates/official/jobs/ci-e2e-tests.yml @@ -54,6 +54,15 @@ jobs: SQL_CONNECTION: $(LinuxSqlConnectionString311) EVENTGRID_URI: $(LinuxEventGridTopicUriString311) EVENTGRID_CONNECTION: $(LinuxEventGridConnectionKeyString311) + Python312: + PYTHON_VERSION: '3.12' + STORAGE_CONNECTION: $(LinuxStorageConnectionString312) + COSMOSDB_CONNECTION: $(LinuxCosmosDBConnectionString312) + EVENTHUB_CONNECTION: $(LinuxEventHubConnectionString312) + SERVICEBUS_CONNECTION: $(LinuxServiceBusConnectionString312) + SQL_CONNECTION: $(LinuxSqlConnectionString312) + EVENTGRID_URI: $(LinuxEventGridTopicUriString312) + EVENTGRID_CONNECTION: $(LinuxEventGridConnectionKeyString312) steps: - task: UsePythonVersion@0 inputs: diff --git a/eng/templates/official/jobs/ci-lc-tests.yml b/eng/templates/official/jobs/ci-lc-tests.yml index 47ca75711..f41946af3 100644 --- a/eng/templates/official/jobs/ci-lc-tests.yml +++ b/eng/templates/official/jobs/ci-lc-tests.yml @@ -11,20 +11,15 @@ jobs: matrix: Python37: PYTHON_VERSION: '3.7' - STORAGE_CONNECTION: $(LinuxStorageConnectionString37) Python38: PYTHON_VERSION: '3.8' - STORAGE_CONNECTION: $(LinuxStorageConnectionString38) Python39: PYTHON_VERSION: '3.9' - STORAGE_CONNECTION: $(LinuxStorageConnectionString39) Python310: PYTHON_VERSION: '3.10' - STORAGE_CONNECTION: $(LinuxStorageConnectionString310) Python311: PYTHON_VERSION: '3.11' - STORAGE_CONNECTION: $(LinuxStorageConnectionString311) - + steps: - task: UsePythonVersion@0 inputs: @@ -39,6 +34,6 @@ jobs: - bash: | python -m pytest -n auto --dist loadfile -vv --reruns 4 --instafail tests/consumption_tests env: - AzureWebJobsStorage: $(STORAGE_CONNECTION) + AzureWebJobsStorage: $(LinuxStorageConnectionString312) _DUMMY_CONT_KEY: $(_DUMMY_CONT_KEY) displayName: "Running $(PYTHON_VERSION) Linux Consumption tests" \ No newline at end of file diff --git a/pack/Microsoft.Azure.Functions.V4.PythonWorker.nuspec b/pack/Microsoft.Azure.Functions.V4.PythonWorker.nuspec index 2b6854a07..b3ce47d0c 100644 --- a/pack/Microsoft.Azure.Functions.V4.PythonWorker.nuspec +++ b/pack/Microsoft.Azure.Functions.V4.PythonWorker.nuspec @@ -33,6 +33,11 @@ + + + + + diff --git a/pyproject.toml b/pyproject.toml index 642aba668..21042ec5d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,11 +29,11 @@ dependencies = [ "azure-functions==1.20.0", "python-dateutil ~=2.9.0", "protobuf~=3.19.3; python_version == '3.7'", - "protobuf~=4.22.0; python_version >= '3.8'", + "protobuf~=4.25.3; python_version >= '3.8'", "grpcio-tools~=1.43.0; python_version == '3.7'", - "grpcio-tools~=1.54.2; python_version >= '3.8'", + "grpcio-tools~=1.59.0; python_version >= '3.8'", "grpcio~=1.43.0; python_version == '3.7'", - "grpcio~=1.54.2; python_version >= '3.8'", + "grpcio~=1.59.0; python_version >= '3.8'", "azurefunctions-extensions-base; python_version >= '3.8'" ] @@ -49,7 +49,8 @@ dev = [ "fastapi~=0.103.2", "pydantic", "pycryptodome==3.*", - "flake8==5.*", + "flake8==5.*; python_version == '3.7'", + "flake8==6.*; python_version >= '3.8'", "mypy", "pytest~=7.4.4", "requests==2.*", diff --git a/python/prodV4/worker.config.json b/python/prodV4/worker.config.json index f22d26f45..2289ba867 100644 --- a/python/prodV4/worker.config.json +++ b/python/prodV4/worker.config.json @@ -1,9 +1,9 @@ { "description":{ "language":"python", - "defaultRuntimeVersion":"3.10", + "defaultRuntimeVersion":"3.11", "supportedOperatingSystems":["LINUX", "OSX", "WINDOWS"], - "supportedRuntimeVersions":["3.7", "3.8", "3.9", "3.10", "3.11"], + "supportedRuntimeVersions":["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"], "supportedArchitectures":["X64", "X86", "Arm64"], "extensions":[".py"], "defaultExecutablePath":"python", diff --git a/python/prodV4/worker.py b/python/prodV4/worker.py index 3365b69c3..021fa3f03 100644 --- a/python/prodV4/worker.py +++ b/python/prodV4/worker.py @@ -35,13 +35,10 @@ def determine_user_pkg_paths(): """ minor_version = sys.version_info[1] - usr_packages_path = [] - - if minor_version in (7, 8, 9, 10, 11): - usr_packages_path.append(os.path.join(PKGS_PATH, PKGS)) - else: + if not (7 <= minor_version <= 12): raise RuntimeError(f'Unsupported Python version: 3.{minor_version}') + usr_packages_path = [os.path.join(PKGS_PATH, PKGS)] return usr_packages_path diff --git a/tests/test_setup.py b/tests/test_setup.py index 7dd686121..fd6f0044e 100644 --- a/tests/test_setup.py +++ b/tests/test_setup.py @@ -31,7 +31,7 @@ from invoke import task -from tests.utils.constants import EXTENSIONS_CSPROJ_TEMPLATE, NUGET_CONFIG +from utils.constants import EXTENSIONS_CSPROJ_TEMPLATE, NUGET_CONFIG ROOT_DIR = pathlib.Path(__file__).parent.parent BUILD_DIR = ROOT_DIR / 'build' diff --git a/tests/unittests/test_utilities.py b/tests/unittests/test_utilities.py index ba4fdfb7f..99b014e09 100644 --- a/tests/unittests/test_utilities.py +++ b/tests/unittests/test_utilities.py @@ -320,13 +320,15 @@ def test_is_python_version(self): is_python_version_39 = common.is_python_version('3.9') is_python_version_310 = common.is_python_version('3.10') is_python_version_311 = common.is_python_version('3.11') + is_python_version_312 = common.is_python_version('3.12') self.assertTrue(any([ is_python_version_37, is_python_version_38, is_python_version_39, is_python_version_310, - is_python_version_311 + is_python_version_311, + is_python_version_312 ])) def test_get_sdk_from_sys_path(self):