Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Update to support py312 #1533

Merged
merged 14 commits into from
Jul 22, 2024
Merged
2 changes: 2 additions & 0 deletions eng/templates/jobs/ci-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
PYTHON_VERSION: '3.10'
Python311:
PYTHON_VERSION: '3.11'
Python312:
PYTHON_VERSION: '3.12'

steps:
- task: UsePythonVersion@0
Expand Down
3 changes: 3 additions & 0 deletions eng/templates/official/jobs/build-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 9 additions & 0 deletions eng/templates/official/jobs/ci-docker-consumption-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions eng/templates/official/jobs/ci-docker-dedicated-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions eng/templates/official/jobs/ci-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 2 additions & 7 deletions eng/templates/official/jobs/ci-lc-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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"
5 changes: 5 additions & 0 deletions pack/Microsoft.Azure.Functions.V4.PythonWorker.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
<file src="..\3.11_LINUX_X64\**" target="tools\3.11\LINUX\X64" />
<file src="..\3.11_OSX_X64\**" target="tools\3.11\OSX\X64" />
<file src="..\3.11_OSX_X64\**" target="tools\3.11\OSX\Arm64" />
<file src="..\3.12_WINDOWS_X64\**" target="tools\3.12\WINDOWS\X64" />
<file src="..\3.12_WINDOWS_X86\**" target="tools\3.12\WINDOWS\X86" />
<file src="..\3.12_LINUX_X64\**" target="tools\3.12\LINUX\X64" />
<file src="..\3.12_OSX_X64\**" target="tools\3.12\OSX\X64" />
<file src="..\3.12_OSX_X64\**" target="tools\3.12\OSX\Arm64" />
<file src="..\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" />
Expand Down
9 changes: 5 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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'"
]

Expand All @@ -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.*",
Expand Down
4 changes: 2 additions & 2 deletions python/prodV4/worker.config.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
7 changes: 2 additions & 5 deletions python/prodV4/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion tests/test_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 3 additions & 1 deletion tests/unittests/test_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Loading