This is an automated email from the ASF dual-hosted git repository.

vterentev pushed a commit to branch fix-cibuildwheel
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/fix-cibuildwheel by this push:
     new cd8376d1a86 Use cibwEnvdir
cd8376d1a86 is described below

commit cd8376d1a86b521780a6d6987d2a294a20d2dff8
Author: Vitaly Terentyev <[email protected]>
AuthorDate: Wed Feb 25 21:30:27 2026 +0400

    Use cibwEnvdir
---
 .../beam_PostCommit_Python_Xlang_IO_Dataflow.yml   |  1 -
 .../org/apache/beam/gradle/BeamModulePlugin.groovy | 22 ++++++++++++++++++++++
 sdks/python/build.gradle                           |  6 ++----
 3 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/beam_PostCommit_Python_Xlang_IO_Dataflow.yml 
b/.github/workflows/beam_PostCommit_Python_Xlang_IO_Dataflow.yml
index e7aa50c7311..66c820ad0be 100644
--- a/.github/workflows/beam_PostCommit_Python_Xlang_IO_Dataflow.yml
+++ b/.github/workflows/beam_PostCommit_Python_Xlang_IO_Dataflow.yml
@@ -81,7 +81,6 @@ jobs:
         with:
           gradle-command: 
:sdks:python:test-suites:dataflow:ioCrossLanguagePostCommit
           arguments: |
-            -PpythonVersion=3.13
             -PuseWheelDistribution \
             
-PkafkaBootstrapServer=10.128.0.40:9094,10.128.0.28:9094,10.128.0.165:9094 \
       - name: Archive Python Test Results
diff --git 
a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy 
b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy
index 76f380c94bb..b17d5a7e176 100644
--- a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy
+++ b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy
@@ -3091,6 +3091,7 @@ class BeamModulePlugin implements Plugin<Project> {
       // virtualenv activated properly. So instead of include project name in 
the path,
       // we use the hash value.
       project.ext.envdir = 
"${project.rootProject.buildDir}/gradleenv/${project.path.hashCode()}"
+      project.ext.cibwEnvdir = 
"${project.rootProject.buildDir}/cibwenv/${project.path.hashCode()}"
       def pythonRootDir = "${project.rootDir}/sdks/python"
 
       // Python interpreter version for virtualenv setup and test run. This 
value can be
@@ -3134,6 +3135,27 @@ class BeamModulePlugin implements Plugin<Project> {
         outputs.upToDateWhen { false }
       }
 
+      def setupCibuildwheelVirtualenv = 
project.tasks.register('setupCibuildwheelVirtualenv')  {
+        doLast {
+          project.exec {
+            executable 'sh'
+            args '-c', [
+              "python3.13 -m venv --clear ${project.ext.cibwEnvdir}",
+            ].join(' ')
+          }
+          project.exec {
+            executable 'sh'
+            args '-c', ". ${project.ext.cibwEnvdir}/bin/activate && " +
+              "pip install --pre --retries 10 --upgrade pip==25.0.1 
--no-cache-dir && " +
+              "pip install --retries 10 --upgrade setuptools --no-cache-dir && 
" +
+              "pip install --retries 10 cibuildwheel==3.3.1 --no-cache-dir"
+          }
+        }
+
+        outputs.dirs(project.ext.cibwEnvdir)
+        outputs.upToDateWhen { false }
+      }
+
       project.ext.pythonSdkDeps = project.files(
           project.fileTree(
           dir: "${project.rootDir}",
diff --git a/sdks/python/build.gradle b/sdks/python/build.gradle
index 6e0786d9855..7200b85cbd7 100644
--- a/sdks/python/build.gradle
+++ b/sdks/python/build.gradle
@@ -200,11 +200,10 @@ platform_identifiers_map.each { platform, idsuffix ->
   }
   getVersionsAsList('python_versions').each { it ->
     def pyversion = it.replace('.', '')
-    def cibuildwheel_version = it == '3.10' ? '2.23.3' : '3.3.1'
 
     project.tasks.register("bdistPy${pyversion}${platform}") {
       description "Build a Python wheel distribution for Py${pyversion} 
${platform}"
-      dependsOn setupVirtualenv
+      dependsOn setupCibuildwheelVirtualenv
       // need sdist task to generate protos
       dependsOn ':sdks:python:sdist'
 
@@ -218,10 +217,9 @@ platform_identifiers_map.each { platform, idsuffix ->
             exec {
              environment CIBW_BUILD: "cp${pyversion}-${idsuffix}"
              executable 'sh'
-             args '-c', ". ${envdir}/bin/activate && " +
+             args '-c', ". ${project.ext.cibwEnvdir}/bin/activate && " +
                  // note: sync cibuildwheel version with GitHub Action
                  // .github/workflows/build_wheel.yml:build_wheels "Install 
cibuildwheel" step
-                 "pip install cibuildwheel==${cibuildwheel_version} setuptools 
&& " +
                  "cibuildwheel --print-build-identifiers --platform 
${platform} --archs ${archs} && " +
                  "cibuildwheel --output-dir ${buildDir} --platform ${platform} 
--archs ${archs} "
            }

Reply via email to