Skip to content

Commit ed7414f

Browse files
authored
build: use official grpc for python 3.14 (#1780)
* use official grpc * comment out script * linux-arm64 support * fix linux-arm64 support * fix linux-arm64 support script * fix linux-arm64 image cmds * add linux-arm64 to nuget * fix linux-arm64 grpc check * remove grpc check for linux-arm64
1 parent b549ddb commit ed7414f

File tree

8 files changed

+138
-34
lines changed

8 files changed

+138
-34
lines changed

eng/pack/Microsoft.Azure.Functions.V4.PythonWorker.nuspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
<file src="..\..\3.14_LINUX_X64\**" target="tools\3.14\LINUX\X64" />
5454
<file src="..\..\3.14_OSX_X64\**" target="tools\3.14\OSX\X64" />
5555
<file src="..\..\3.14_OSX_ARM64\**" target="tools\3.14\OSX\Arm64" />
56+
<file src="..\..\3.14_LINUX_ARM64\**" target="tools\3.14\LINUX\Arm64" />
5657
<file src="..\..\workers\python\prodV4\worker.config.json" target="tools" />
5758
<file src="Microsoft.Azure.Functions.PythonWorker.targets" target="build" />
5859
<file src="..\..\_manifest\spdx_2.2\manifest.spdx.json" target="SBOM\manifest.spdx.json" />
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#!/bin/bash
2+
3+
python -m venv .env
4+
source .env/bin/activate
5+
python -m pip install --upgrade pip
6+
7+
version_minor=$(echo $1 | cut -d '.' -f 2)
8+
mkdir -p $BUILD_SOURCESDIRECTORY/deps
9+
10+
# Targeting: grpcio manylinux_2_17_aarch64.whl build
11+
12+
# Starts a docker container using the linux/arm64 platform
13+
# Inside the container, we perform the same steps as our typical builds
14+
# However, since we're running them on the linux/arm64 platform, we ensure
15+
# that we pull in the correct grpc, etc. builds
16+
docker run --privileged --rm tonistiigi/binfmt --install all
17+
docker run --name my-arm64-container --platform linux/arm64 \
18+
-v ./:/src \
19+
-w /src \
20+
python:3.14.0rc3-alpine3.22 sh -c "
21+
ls -la /src # debug: see what files exist
22+
apk update && apk add --no-cache git curl build-base && \
23+
pip install --upgrade pip && \
24+
cd workers && \
25+
pip install . && \
26+
pip install . --target /src && \
27+
pip install invoke && \
28+
cd tests && \
29+
python -m invoke -c test_setup build-protos && \
30+
ls -la /src
31+
"
32+
33+
cd workers
34+
35+
# This copies over the build files from the docker container to the local pipeline
36+
docker cp my-arm64-container:/src/. $BUILD_SOURCESDIRECTORY/all/
37+
docker rm my-arm64-container
38+
39+
# From the container, we have many unnecessary files. Here, we only
40+
# copy over the relevant files to the 'deps/' directory.
41+
copy_list=(
42+
"azure"
43+
"azure_functions_worker"
44+
"azure_functions_runtime"
45+
"azure_functions_runtime_v1"
46+
"azurefunctions"
47+
"dateutil"
48+
"google"
49+
"grpc"
50+
"markupsafe"
51+
"proxy_worker"
52+
"six.py"
53+
"werkzeug"
54+
)
55+
56+
for dir in "${copy_list[@]}"; do
57+
src="$BUILD_SOURCESDIRECTORY/all/$dir"
58+
dest="$BUILD_SOURCESDIRECTORY/deps"
59+
60+
if [ -e $src ]; then
61+
echo "Copying $dir..."
62+
cp -r $src $dest
63+
else
64+
echo "Directory $dir not found in deps — skipping"
65+
fi
66+
done
67+
68+
cp .artifactignore "$BUILD_SOURCESDIRECTORY/deps"
69+
70+
version_minor=$(echo $1 | cut -d '.' -f 2)
71+
if [[ $version_minor -lt 13 ]]; then
72+
cp -r azure_functions_worker/protos "$BUILD_SOURCESDIRECTORY/deps/azure_functions_worker"
73+
else
74+
cp -r proxy_worker/protos "$BUILD_SOURCESDIRECTORY/deps/proxy_worker"
75+
fi
76+
77+
echo "Listing contents of deps directory:"
78+
ls -la $BUILD_SOURCESDIRECTORY/deps

eng/pack/templates/macos_64_env_gen.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ steps:
5757
scriptPath: 'eng/pack/scripts/mac_arm64_deps.sh'
5858
args: '${{ parameters.pythonVersion }}'
5959
displayName: 'Install dependencies'
60-
condition: eq(variables['isRC'], 'false')
61-
- task: ShellScript@2
62-
inputs:
63-
disableAutoCwd: true
64-
scriptPath: 'eng/pack/scripts/rc_mac_arm64_deps.sh'
65-
args: '${{ parameters.pythonVersion }}'
66-
displayName: 'Build dependencies from source'
67-
condition: eq(variables['isRC'], 'true')
60+
# condition: eq(variables['isRC'], 'false')
61+
# - task: ShellScript@2
62+
# inputs:
63+
# disableAutoCwd: true
64+
# scriptPath: 'eng/pack/scripts/rc_mac_arm64_deps.sh'
65+
# args: '${{ parameters.pythonVersion }}'
66+
# displayName: 'Build dependencies from source'
67+
# condition: eq(variables['isRC'], 'true')
6868
- bash: |
6969
pip install pip-audit
7070
cd workers

eng/pack/templates/nix_arm64_env_gen.yml

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ steps:
77
- task: UsePythonVersion@0
88
inputs:
99
versionSpec: ${{ parameters.pythonVersion }}
10+
allowUnstable: true
1011
addToPath: true
1112
- powershell: |
1213
# Parse the Python minor version
@@ -22,6 +23,16 @@ steps:
2223
Write-Host "Minor version: $PY_MINOR"
2324
Write-Host "##vso[task.setvariable variable=minorVersion;]$PY_MINOR"
2425
26+
# Detect if this is an RC build
27+
if ($PY_VER -match "rc") {
28+
Write-Host "RC version detected"
29+
Write-Host "##vso[task.setvariable variable=isRC;]true"
30+
}
31+
else {
32+
Write-Host "Stable version detected"
33+
Write-Host "##vso[task.setvariable variable=isRC;]false"
34+
}
35+
2536
# Set build-related variables based on Python minor version
2637
if( $PY_MINOR -ge 13 )
2738
{
@@ -51,7 +62,15 @@ steps:
5162
disableAutoCwd: true
5263
scriptPath: 'eng/pack/scripts/nix_arm64_deps.sh'
5364
args: '${{ parameters.pythonVersion }}'
54-
displayName: 'Install Dependencies'
65+
displayName: 'Install dependencies'
66+
condition: eq(variables['isRC'], 'false')
67+
- task: ShellScript@2
68+
inputs:
69+
disableAutoCwd: true
70+
scriptPath: 'eng/pack/scripts/rc_nix_arm64_deps.sh'
71+
args: '${{ parameters.pythonVersion }}'
72+
displayName: 'Build dependencies from scratch'
73+
condition: eq(variables['isRC'], 'true')
5574
- bash: |
5675
pip install pip-audit
5776
cd workers
@@ -207,16 +226,16 @@ steps:
207226
$missing += $item
208227
}
209228
}
210-
# === gRPC check ===
211-
$grpcPattern = "*$(majorVersion)$(minorVersion)-${{ parameters.grpcBuild }}"
212-
$grpcMatch = Get-ChildItem -Path $cythonDir -Name -ErrorAction SilentlyContinue |
213-
Where-Object { $_ -like $grpcPattern }
229+
# # === gRPC check ===
230+
# $grpcPattern = "*$(majorVersion)$(minorVersion)-${{ parameters.grpcBuild }}"
231+
# $grpcMatch = Get-ChildItem -Path $cythonDir -Name -ErrorAction SilentlyContinue |
232+
# Where-Object { $_ -like $grpcPattern }
214233
215-
if (-not $grpcMatch) {
216-
$missing += "grpc/_cython/$grpcPattern"
217-
} else {
218-
Write-Host "✅ Found gRPC binary: $grpcMatch"
219-
}
234+
# if (-not $grpcMatch) {
235+
# $missing += "grpc/_cython/$grpcPattern"
236+
# } else {
237+
# Write-Host "✅ Found gRPC binary: $grpcMatch"
238+
# }
220239
221240
if ($missing.Count -gt 0) {
222241
Write-Error "Validation failed. Missing expected files/folders:`n$($missing -join "`n")"

eng/pack/templates/nix_env_gen.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ steps:
5757
scriptPath: 'eng/pack/scripts/nix_deps.sh'
5858
args: '${{ parameters.pythonVersion }}'
5959
displayName: 'Install Dependencies'
60-
condition: eq(variables['isRC'], 'false')
61-
- task: ShellScript@2
62-
inputs:
63-
disableAutoCwd: true
64-
scriptPath: 'eng/pack/scripts/rc_nix_deps.sh'
65-
args: '${{ parameters.pythonVersion }}'
66-
displayName: 'Build dependencies from source'
67-
condition: eq(variables['isRC'], 'true')
60+
# condition: eq(variables['isRC'], 'false')
61+
# - task: ShellScript@2
62+
# inputs:
63+
# disableAutoCwd: true
64+
# scriptPath: 'eng/pack/scripts/rc_nix_deps.sh'
65+
# args: '${{ parameters.pythonVersion }}'
66+
# displayName: 'Build dependencies from source'
67+
# condition: eq(variables['isRC'], 'true')
6868
- bash: |
6969
pip install pip-audit
7070
cd workers

eng/pack/templates/win_env_gen.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ steps:
5757
filePath: 'eng\pack\scripts\win_deps.ps1'
5858
arguments: '${{ parameters.pythonVersion }}'
5959
displayName: 'Install dependencies'
60-
condition: eq(variables['isRC'], 'false')
61-
- task: PowerShell@2
62-
inputs:
63-
filePath: 'eng\pack\scripts\rc_win_deps.ps1'
64-
arguments: '${{ parameters.pythonVersion }}'
65-
displayName: 'Build dependencies from source'
66-
condition: eq(variables['isRC'], 'true')
60+
# condition: eq(variables['isRC'], 'false')
61+
# - task: PowerShell@2
62+
# inputs:
63+
# filePath: 'eng\pack\scripts\rc_win_deps.ps1'
64+
# arguments: '${{ parameters.pythonVersion }}'
65+
# displayName: 'Build dependencies from source'
66+
# condition: eq(variables['isRC'], 'true')
6767
- bash: |
6868
pip install pip-audit
6969
cd workers

eng/templates/official/jobs/build-artifacts.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,9 @@ jobs:
238238
Python313V4:
239239
pythonVersion: '3.13'
240240
normalizedPythonVersion: '3.13'
241+
Python314V4:
242+
pythonVersion: '3.14.0-rc.2'
243+
normalizedPythonVersion: '3.14'
241244
templateContext:
242245
outputParentDirectory: $(Build.ArtifactStagingDirectory)
243246
outputs:

workers/pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,16 @@ dependencies = [
3232
"python-dateutil~=2.9.0",
3333
"protobuf~=3.19.3; python_version == '3.7'",
3434
"protobuf~=4.25.3; python_version >= '3.8' and python_version < '3.13'",
35-
"protobuf~=5.29.0; python_version >= '3.13'",
35+
"protobuf~=5.29.0; python_version == '3.13'",
36+
"protobuf~=6.32.1; python_version == '3.14'",
3637
"grpcio-tools~=1.43.0; python_version == '3.7'",
3738
"grpcio-tools~=1.59.0; python_version >= '3.8' and python_version < '3.13'",
3839
"grpcio-tools~=1.70.0; python_version == '3.13'",
40+
"grpcio-tools~=1.75.1; python_version == '3.14'",
3941
"grpcio~=1.43.0; python_version == '3.7'",
4042
"grpcio ~=1.59.0; python_version >= '3.8' and python_version < '3.13'",
4143
"grpcio~=1.70.0; python_version == '3.13'",
44+
"grpcio~=1.75.1; python_version == '3.14'",
4245
"uvloop~=0.21.0; python_version >= '3.13' and sys_platform != 'win32'",
4346
"azurefunctions-extensions-base==1.1.0; python_version >= '3.8'",
4447
"azure-functions-runtime==1.1.0b1; python_version >= '3.13'",

0 commit comments

Comments
 (0)