Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@ jobs:
commit: '${{ env.prsha || env.GITHUB_SHA }}'
comment_mode: ${{ github.event_name == 'issue_comment' && 'always' || 'off' }}
files: '**/pytest*.xml'
large_files: true
large_files: true
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}",
Expand Down
6 changes: 2 additions & 4 deletions sdks/python/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -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} "
}
Expand Down
Loading