Skip to content

Commit 5e0c2ff

Browse files
authored
chore(ci): skip packages with unsupported pre-release deps in import profiler (#18033)
Skip packages with heavy native/scientific dependencies (bigframes, pandas-gbq, google-cloud-documentai-toolbox, db-dtypes, bigquery-magics) that fail to build on Python 3.15 due to missing pre-built wheels. Test PR: #18034 Fixes: b/535231604
1 parent 57e7822 commit 5e0c2ff

1 file changed

Lines changed: 60 additions & 11 deletions

File tree

ci/run_single_test.sh

Lines changed: 60 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,35 @@ case ${TEST_TYPE} in
9898
;;
9999
import_profile)
100100
if [ -f setup.py ] || [ -f pyproject.toml ]; then
101+
PACKAGE_NAME=$(basename $(pwd))
102+
103+
# TODO(https://github.com/googleapis/google-cloud-python/issues/18035):
104+
# Remove this skip once Python 3.15 is officially released and upstream binary wheels
105+
# (e.g. numpy, pyarrow, pandas, geopandas, pikepdf) are published on PyPI.
106+
# Packages with heavy C/Rust dependencies attempt full source compilation on pre-release Python,
107+
# taking 5-10+ minutes before failing due to unreleased CPython 3.15 C-API changes.
108+
if [[ "${PY_VERSION}" == "3.15"* ]]; then
109+
UNSUPPORTED_PRE_RELEASE_PACKAGES=(
110+
"bigframes"
111+
"pandas-gbq"
112+
"google-cloud-documentai-toolbox"
113+
"db-dtypes"
114+
"bigquery-magics"
115+
)
116+
for unsupported in "${UNSUPPORTED_PRE_RELEASE_PACKAGES[@]}"; do
117+
if [ "${PACKAGE_NAME}" = "${unsupported}" ]; then
118+
echo "WARNING: Skipping import_profile for ${PACKAGE_NAME}: package has heavy C/Rust dependencies not yet supported on pre-release Python ${PY_VERSION}."
119+
exit 0
120+
fi
121+
done
122+
fi
123+
101124
echo "Creating temporary virtualenv for import profile..."
102125
python3 -m venv .venv-profiler
103126
source .venv-profiler/bin/activate
104127
export PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1
105128
python -m pip install --upgrade pip setuptools
106129

107-
PACKAGE_NAME=$(basename $(pwd))
108130
PROFILER_TEMP_DIR=$(mktemp -d)
109131
cp ../../scripts/import_profiler/profiler.py "${PROFILER_TEMP_DIR}/profiler.py"
110132
PROFILER_SCRIPT="${PROFILER_TEMP_DIR}/profiler.py"
@@ -121,13 +143,26 @@ case ${TEST_TYPE} in
121143
WORKTREE_DIR=$(mktemp -d)
122144
rmdir "${WORKTREE_DIR}"
123145
if git worktree add "${WORKTREE_DIR}" "${BASELINE_COMMIT}" 2>/dev/null; then
124-
(
146+
if ! (
125147
cd "${WORKTREE_DIR}/${REPO_PREFIX}"
126148
if [ -f setup.py ] || [ -f pyproject.toml ]; then
127-
pip install -e .
128-
python "${PROFILER_SCRIPT}" --package "${PACKAGE_NAME}" --iterations 11 --csv "${BASELINE_CSV}"
149+
if pip install -e . ; then
150+
echo "INFO: Successfully installed baseline dependencies for ${PACKAGE_NAME}."
151+
python "${PROFILER_SCRIPT}" --package "${PACKAGE_NAME}" --iterations 11 --csv "${BASELINE_CSV}"
152+
if [ $? -eq 0 ]; then
153+
echo "INFO: Successfully ran baseline profiler for ${PACKAGE_NAME}."
154+
fi
155+
elif [[ "${PY_VERSION}" != "3.15"* ]]; then
156+
exit 1
157+
fi
129158
fi
130-
)
159+
); then
160+
git worktree remove -f "${WORKTREE_DIR}"
161+
deactivate
162+
rm -rf .venv-profiler
163+
rm -rf "${PROFILER_TEMP_DIR}"
164+
exit 1
165+
fi
131166
git worktree remove -f "${WORKTREE_DIR}"
132167
else
133168
echo "Failed to create git worktree for baseline. Skipping baseline generation."
@@ -137,14 +172,28 @@ case ${TEST_TYPE} in
137172
fi
138173
fi
139174

140-
pip install -e .
141-
142-
if [ -f "${BASELINE_CSV}" ]; then
143-
python ${PROFILER_SCRIPT} --package ${PACKAGE_NAME} --iterations 11 --fail-threshold 5000 --diff-baseline "${BASELINE_CSV}" --diff-threshold 100
175+
# TODO(https://github.com/googleapis/google-cloud-python/issues/18035):
176+
# Clean up this fallback once Python 3.15 is officially released and upstream binary wheels are available on PyPI.
177+
# On pre-release Python versions, packages with complex C/Rust dependencies (e.g. bigframes) fail during pip install due to missing pre-built wheels.
178+
if ! pip install -e . ; then
179+
if [[ "${PY_VERSION}" == "3.15"* ]]; then
180+
echo "WARNING: Could not install dependencies for ${PACKAGE_NAME} on Python ${PY_VERSION} (missing pre-built binary wheels for pre-release Python). Skipping import_profile."
181+
retval=0
182+
else
183+
retval=1
184+
fi
144185
else
145-
python ${PROFILER_SCRIPT} --package ${PACKAGE_NAME} --iterations 11 --fail-threshold 5000
186+
echo "INFO: Successfully installed dependencies for ${PACKAGE_NAME} on Python ${PY_VERSION}."
187+
if [ -f "${BASELINE_CSV}" ]; then
188+
python ${PROFILER_SCRIPT} --package ${PACKAGE_NAME} --iterations 11 --fail-threshold 5000 --diff-baseline "${BASELINE_CSV}" --diff-threshold 100
189+
else
190+
python ${PROFILER_SCRIPT} --package ${PACKAGE_NAME} --iterations 11 --fail-threshold 5000
191+
fi
192+
retval=$?
193+
if [ $retval -eq 0 ]; then
194+
echo "INFO: Successfully completed import_profile for ${PACKAGE_NAME}."
195+
fi
146196
fi
147-
retval=$?
148197
deactivate
149198
rm -rf .venv-profiler
150199
rm -rf "${PROFILER_TEMP_DIR}"

0 commit comments

Comments
 (0)