diff --git a/eng/pack/Microsoft.Azure.Functions.V4.PythonWorker.nuspec b/eng/pack/Microsoft.Azure.Functions.V4.PythonWorker.nuspec index 361995fb..8adbb7c6 100644 --- a/eng/pack/Microsoft.Azure.Functions.V4.PythonWorker.nuspec +++ b/eng/pack/Microsoft.Azure.Functions.V4.PythonWorker.nuspec @@ -53,6 +53,7 @@ + diff --git a/eng/pack/scripts/rc_nix_arm64_deps.sh b/eng/pack/scripts/rc_nix_arm64_deps.sh new file mode 100644 index 00000000..20da0118 --- /dev/null +++ b/eng/pack/scripts/rc_nix_arm64_deps.sh @@ -0,0 +1,78 @@ +#!/bin/bash + +python -m venv .env +source .env/bin/activate +python -m pip install --upgrade pip + +version_minor=$(echo $1 | cut -d '.' -f 2) +mkdir -p $BUILD_SOURCESDIRECTORY/deps + +# Targeting: grpcio manylinux_2_17_aarch64.whl build + +# Starts a docker container using the linux/arm64 platform +# Inside the container, we perform the same steps as our typical builds +# However, since we're running them on the linux/arm64 platform, we ensure +# that we pull in the correct grpc, etc. builds +docker run --privileged --rm tonistiigi/binfmt --install all +docker run --name my-arm64-container --platform linux/arm64 \ + -v ./:/src \ + -w /src \ + python:3.14.0rc3-alpine3.22 sh -c " + ls -la /src # debug: see what files exist + apk update && apk add --no-cache git curl build-base && \ + pip install --upgrade pip && \ + cd workers && \ + pip install . && \ + pip install . --target /src && \ + pip install invoke && \ + cd tests && \ + python -m invoke -c test_setup build-protos && \ + 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 + +# From the container, we have many unnecessary files. Here, we only +# copy over the relevant files to the 'deps/' directory. +copy_list=( + "azure" + "azure_functions_worker" + "azure_functions_runtime" + "azure_functions_runtime_v1" + "azurefunctions" + "dateutil" + "google" + "grpc" + "markupsafe" + "proxy_worker" + "six.py" + "werkzeug" +) + +for dir in "${copy_list[@]}"; do + src="$BUILD_SOURCESDIRECTORY/all/$dir" + dest="$BUILD_SOURCESDIRECTORY/deps" + + if [ -e $src ]; then + echo "Copying $dir..." + cp -r $src $dest + else + echo "Directory $dir not found in deps — skipping" + fi + done + +cp .artifactignore "$BUILD_SOURCESDIRECTORY/deps" + +version_minor=$(echo $1 | cut -d '.' -f 2) +if [[ $version_minor -lt 13 ]]; then + cp -r azure_functions_worker/protos "$BUILD_SOURCESDIRECTORY/deps/azure_functions_worker" +else + cp -r proxy_worker/protos "$BUILD_SOURCESDIRECTORY/deps/proxy_worker" +fi + +echo "Listing contents of deps directory:" +ls -la $BUILD_SOURCESDIRECTORY/deps \ No newline at end of file diff --git a/eng/pack/templates/macos_64_env_gen.yml b/eng/pack/templates/macos_64_env_gen.yml index 71b4c097..af1a9f69 100644 --- a/eng/pack/templates/macos_64_env_gen.yml +++ b/eng/pack/templates/macos_64_env_gen.yml @@ -57,14 +57,14 @@ steps: scriptPath: 'eng/pack/scripts/mac_arm64_deps.sh' args: '${{ parameters.pythonVersion }}' displayName: 'Install dependencies' - condition: eq(variables['isRC'], 'false') -- task: ShellScript@2 - inputs: - disableAutoCwd: true - scriptPath: 'eng/pack/scripts/rc_mac_arm64_deps.sh' - args: '${{ parameters.pythonVersion }}' - displayName: 'Build dependencies from source' - condition: eq(variables['isRC'], 'true') +# condition: eq(variables['isRC'], 'false') +# - task: ShellScript@2 +# inputs: +# disableAutoCwd: true +# scriptPath: 'eng/pack/scripts/rc_mac_arm64_deps.sh' +# args: '${{ parameters.pythonVersion }}' +# displayName: 'Build dependencies from source' +# condition: eq(variables['isRC'], 'true') - bash: | pip install pip-audit cd workers diff --git a/eng/pack/templates/nix_arm64_env_gen.yml b/eng/pack/templates/nix_arm64_env_gen.yml index 9b30a95c..a6a92b00 100644 --- a/eng/pack/templates/nix_arm64_env_gen.yml +++ b/eng/pack/templates/nix_arm64_env_gen.yml @@ -7,6 +7,7 @@ steps: - task: UsePythonVersion@0 inputs: versionSpec: ${{ parameters.pythonVersion }} + allowUnstable: true addToPath: true - powershell: | # Parse the Python minor version @@ -22,6 +23,16 @@ steps: Write-Host "Minor version: $PY_MINOR" Write-Host "##vso[task.setvariable variable=minorVersion;]$PY_MINOR" + # Detect if this is an RC build + if ($PY_VER -match "rc") { + Write-Host "RC version detected" + Write-Host "##vso[task.setvariable variable=isRC;]true" + } + else { + Write-Host "Stable version detected" + Write-Host "##vso[task.setvariable variable=isRC;]false" + } + # Set build-related variables based on Python minor version if( $PY_MINOR -ge 13 ) { @@ -51,7 +62,15 @@ steps: disableAutoCwd: true scriptPath: 'eng/pack/scripts/nix_arm64_deps.sh' args: '${{ parameters.pythonVersion }}' - displayName: 'Install Dependencies' + displayName: 'Install dependencies' + condition: eq(variables['isRC'], 'false') +- task: ShellScript@2 + inputs: + disableAutoCwd: true + scriptPath: 'eng/pack/scripts/rc_nix_arm64_deps.sh' + args: '${{ parameters.pythonVersion }}' + displayName: 'Build dependencies from scratch' + condition: eq(variables['isRC'], 'true') - bash: | pip install pip-audit cd workers @@ -207,16 +226,16 @@ steps: $missing += $item } } - # === gRPC check === - $grpcPattern = "*$(majorVersion)$(minorVersion)-${{ parameters.grpcBuild }}" - $grpcMatch = Get-ChildItem -Path $cythonDir -Name -ErrorAction SilentlyContinue | - Where-Object { $_ -like $grpcPattern } + # # === gRPC check === + # $grpcPattern = "*$(majorVersion)$(minorVersion)-${{ parameters.grpcBuild }}" + # $grpcMatch = Get-ChildItem -Path $cythonDir -Name -ErrorAction SilentlyContinue | + # Where-Object { $_ -like $grpcPattern } - if (-not $grpcMatch) { - $missing += "grpc/_cython/$grpcPattern" - } else { - Write-Host "✅ Found gRPC binary: $grpcMatch" - } + # if (-not $grpcMatch) { + # $missing += "grpc/_cython/$grpcPattern" + # } else { + # Write-Host "✅ Found gRPC binary: $grpcMatch" + # } if ($missing.Count -gt 0) { Write-Error "Validation failed. Missing expected files/folders:`n$($missing -join "`n")" diff --git a/eng/pack/templates/nix_env_gen.yml b/eng/pack/templates/nix_env_gen.yml index 3d2cd8a0..cb78c8c5 100644 --- a/eng/pack/templates/nix_env_gen.yml +++ b/eng/pack/templates/nix_env_gen.yml @@ -57,14 +57,14 @@ steps: scriptPath: 'eng/pack/scripts/nix_deps.sh' args: '${{ parameters.pythonVersion }}' displayName: 'Install Dependencies' - condition: eq(variables['isRC'], 'false') -- task: ShellScript@2 - inputs: - disableAutoCwd: true - scriptPath: 'eng/pack/scripts/rc_nix_deps.sh' - args: '${{ parameters.pythonVersion }}' - displayName: 'Build dependencies from source' - condition: eq(variables['isRC'], 'true') +# condition: eq(variables['isRC'], 'false') +# - task: ShellScript@2 +# inputs: +# disableAutoCwd: true +# scriptPath: 'eng/pack/scripts/rc_nix_deps.sh' +# args: '${{ parameters.pythonVersion }}' +# displayName: 'Build dependencies from source' +# condition: eq(variables['isRC'], 'true') - bash: | pip install pip-audit cd workers diff --git a/eng/pack/templates/win_env_gen.yml b/eng/pack/templates/win_env_gen.yml index af90096c..d32cef19 100644 --- a/eng/pack/templates/win_env_gen.yml +++ b/eng/pack/templates/win_env_gen.yml @@ -57,13 +57,13 @@ steps: filePath: 'eng\pack\scripts\win_deps.ps1' arguments: '${{ parameters.pythonVersion }}' displayName: 'Install dependencies' - condition: eq(variables['isRC'], 'false') -- task: PowerShell@2 - inputs: - filePath: 'eng\pack\scripts\rc_win_deps.ps1' - arguments: '${{ parameters.pythonVersion }}' - displayName: 'Build dependencies from source' - condition: eq(variables['isRC'], 'true') +# condition: eq(variables['isRC'], 'false') +# - task: PowerShell@2 +# inputs: +# filePath: 'eng\pack\scripts\rc_win_deps.ps1' +# arguments: '${{ parameters.pythonVersion }}' +# displayName: 'Build dependencies from source' +# condition: eq(variables['isRC'], 'true') - bash: | pip install pip-audit cd workers diff --git a/eng/templates/official/jobs/build-artifacts.yml b/eng/templates/official/jobs/build-artifacts.yml index 5b0b1581..900ab0ec 100644 --- a/eng/templates/official/jobs/build-artifacts.yml +++ b/eng/templates/official/jobs/build-artifacts.yml @@ -238,6 +238,9 @@ jobs: Python313V4: pythonVersion: '3.13' normalizedPythonVersion: '3.13' + Python314V4: + pythonVersion: '3.14.0-rc.2' + normalizedPythonVersion: '3.14' templateContext: outputParentDirectory: $(Build.ArtifactStagingDirectory) outputs: diff --git a/workers/pyproject.toml b/workers/pyproject.toml index 33266fa7..2654b27c 100644 --- a/workers/pyproject.toml +++ b/workers/pyproject.toml @@ -32,13 +32,16 @@ dependencies = [ "python-dateutil~=2.9.0", "protobuf~=3.19.3; python_version == '3.7'", "protobuf~=4.25.3; python_version >= '3.8' and python_version < '3.13'", - "protobuf~=5.29.0; python_version >= '3.13'", + "protobuf~=5.29.0; python_version == '3.13'", + "protobuf~=6.32.1; python_version == '3.14'", "grpcio-tools~=1.43.0; python_version == '3.7'", "grpcio-tools~=1.59.0; python_version >= '3.8' and python_version < '3.13'", "grpcio-tools~=1.70.0; python_version == '3.13'", + "grpcio-tools~=1.75.1; python_version == '3.14'", "grpcio~=1.43.0; python_version == '3.7'", "grpcio ~=1.59.0; python_version >= '3.8' and python_version < '3.13'", "grpcio~=1.70.0; python_version == '3.13'", + "grpcio~=1.75.1; python_version == '3.14'", "uvloop~=0.21.0; python_version >= '3.13' and sys_platform != 'win32'", "azurefunctions-extensions-base==1.1.0; python_version >= '3.8'", "azure-functions-runtime==1.1.0b1; python_version >= '3.13'",