Skip to content

Commit 146196b

Browse files
committed
tests: add testing for Python 3.15
1 parent 06c1f05 commit 146196b

54 files changed

Lines changed: 137 additions & 33 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/unittest.yml

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ env:
1818
NOX_ENVDIR: "/tmp/shared_nox_envs"
1919
NOX_DEFAULT_VENV_BACKEND: "uv"
2020
UV_VENV_SEED: "1"
21+
UV_PRERELEASE: "allow"
2122
# Note: PARALLEL_WORKERS must remain "1" for unit tests because running pytest concurrently
2223
# on the same runner VM can cause socket/IPC/process deadlocks across packages.
2324
PARALLEL_WORKERS: "1"
@@ -29,12 +30,13 @@ jobs:
2930
matrix: ${{ steps.set-matrix.outputs.matrix }}
3031
is_full_run: ${{ steps.check-label.outputs.is_full_run }}
3132
env:
32-
MAX_SHARDS: 16
33+
MAX_SHARDS: 20
3334
# Define weights for long-running unit tests to balance shard execution time
3435
# Each weight is roughly 1 minute of expected execution time
3536
# Default for unset packages is 1
3637
PACKAGE_WEIGHTS: |
3738
bigframes: 6
39+
sqlalchemy-spanner: 6
3840
google-ai-generativelanguage: 4
3941
google-auth: 5
4042
google-cloud-compute: 12
@@ -81,9 +83,8 @@ jobs:
8183
if: needs.initialize.outputs.matrix != '[]' && needs.initialize.outputs.matrix != ''
8284
runs-on: ubuntu-22.04
8385
strategy:
84-
fail-fast: true
8586
matrix:
86-
python: ['3.10', "3.11", "3.12", "3.13", "3.14"]
87+
python: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.15"]
8788
package_shard: ${{ fromJson(needs.initialize.outputs.matrix) }}
8889
name: ${{ matrix.package_shard.is_sharded && format('unit ({0}, {1})', matrix.python, matrix.package_shard.name) || format('unit ({0})', matrix.python) }}
8990
steps:
@@ -100,10 +101,40 @@ jobs:
100101
with:
101102
python-version: ${{ matrix.python }}
102103
cache: 'pip'
103-
- name: Install nox
104+
allow-prereleases: true
105+
- name: Setup uv
106+
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
107+
with:
108+
enable-cache: true
109+
cache-dependency-glob: 'packages/**/testing/constraints*.txt'
110+
- name: Install nox and nox-uv
104111
run: |
105-
python -m pip install --upgrade setuptools pip wheel
106-
python -m pip install nox uv
112+
uv pip install --system nox nox-uv
113+
# Caches local wheels for Python 3.15+ to avoid repeatedly downloading or building heavy libraries.
114+
# Follow https://github.com/grpc/grpc/issues/41010 for updates.
115+
- name: Cache Built Python 3.15 Wheels
116+
if: matrix.python == '3.15'
117+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
118+
with:
119+
path: .uv-wheel-cache
120+
key: ${{ runner.os }}-uv-wheels-3.15-${{ hashFiles('packages/**/testing/constraints*.txt') }}
121+
restore-keys: |
122+
${{ runner.os }}-uv-wheels-3.15-
123+
# TODO: Remove this step once official Python 3.15 wheels for grpcio are published to PyPI.
124+
# See https://github.com/grpc/grpc/issues/41010#issuecomment-4848264910 for details.
125+
- name: Install grpcio wheel for Python 3.15
126+
if: matrix.python == '3.15'
127+
run: |
128+
mkdir -p .uv-wheel-cache
129+
WHEEL_FILE=".uv-wheel-cache/grpcio-1.83.0.dev0-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.whl"
130+
if [ ! -f "$WHEEL_FILE" ]; then
131+
curl -L "https://packages.grpc.io/archive/2026/06/5ccdab32010f762634e1082d19be53cf60458456-b37e49c7-5e62-4cbe-870a-c599bb907b04/python/grpcio/grpcio-1.83.0.dev0-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.whl" -o "$WHEEL_FILE"
132+
fi
133+
echo "d7706633cd5d97a8b8d3c6ed36c5940722a9b5cbb47f0d10bc433ee27af36ff0 $WHEEL_FILE" | sha256sum -c
134+
uv pip install --system "$WHEEL_FILE"
135+
echo "UV_FIND_LINKS=${{ github.workspace }}/.uv-wheel-cache" >> $GITHUB_ENV
136+
echo "UV_CACHE_DIR=${{ github.workspace }}/.uv-wheel-cache" >> $GITHUB_ENV
137+
echo "UV_PRERELEASE=allow" >> $GITHUB_ENV
107138
- name: Run unit tests for ${{ matrix.package_shard.description }}
108139
env:
109140
BUILD_TYPE: presubmit

ci/get_package_shards.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def group_packages(packages_map):
165165

166166
# Dynamically determine target weight to balance across max shards.
167167
max_shards = int(os.environ.get("MAX_SHARDS", 16))
168-
target_weight = max(10, math.ceil(total_weight / max_shards))
168+
target_weight = max(6, math.ceil(total_weight / max_shards))
169169

170170
shards_list = []
171171
current_shard_items = []

ci/run_single_test.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ case ${TEST_TYPE} in
9090
nox -s unit-3.14
9191
retval=$?
9292
;;
93+
"3.15")
94+
# This is needed to speed up builds
95+
nox --force-venv-backend uv -s unit-3.15
96+
retval=$?
97+
;;
9398
*)
9499
echo "unsupported PY_VERSION"
95100
exit 1

packages/bigframes/bigframes/_magics.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
)
3838
def _cell_magic(line, cell):
3939
ipython = get_ipython()
40+
if ipython is None:
41+
return
42+
4043
args = magic_arguments.parse_argstring(_cell_magic, line)
4144
if not cell:
4245
print("Query is missing.")

packages/bigframes/noxfile.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060

6161
DEFAULT_PYTHON_VERSION = "3.14"
6262

63-
ALL_PYTHON = ["3.10", "3.11", "3.12", "3.13", "3.14"]
63+
ALL_PYTHON = ["3.10", "3.11", "3.12", "3.13", "3.14", "3.15"]
6464
UNIT_TEST_STANDARD_DEPENDENCIES = [
6565
"mock",
6666
PYTEST_VERSION,
@@ -283,6 +283,10 @@ def run_unit(session, install_test_extra):
283283
@nox.session(python=ALL_PYTHON)
284284
@nox.parametrize("test_extra", [True, False])
285285
def unit(session, test_extra):
286+
if session.python == "3.15":
287+
session.skip(
288+
"Skipping 3.15 until wheels are available for pyarrow. Also pyproj wheels are needed for dependency geopandas."
289+
)
286290
if test_extra:
287291
run_unit(session, install_test_extra=test_extra)
288292
else:

packages/bigquery-magics/noxfile.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"3.12",
4242
"3.13",
4343
"3.14",
44+
"3.15",
4445
]
4546

4647
UNIT_TEST_STANDARD_DEPENDENCIES = [
@@ -237,6 +238,10 @@ def install_unittest_dependencies(session, *constraints):
237238
@nox.session(python=UNIT_TEST_PYTHON_VERSIONS)
238239
def unit(session):
239240
# Install all test dependencies, then install this package in-place.
241+
if session.python == "3.15":
242+
session.skip(
243+
"Skipping 3.15 until wheels are available for pyproj needed for dependency geopandas"
244+
)
240245

241246
constraints_path = str(
242247
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"

packages/bigquery-magics/testing/constraints-3.15.txt

Whitespace-only changes.

packages/db-dtypes/noxfile.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"3.12",
4343
"3.13",
4444
"3.14",
45+
"3.15",
4546
]
4647

4748
UNIT_TEST_STANDARD_DEPENDENCIES = [
@@ -302,6 +303,8 @@ def prerelease(session, tests_path):
302303
@nox.parametrize("test_type", ["unit", "compliance"])
303304
def unit(session, test_type):
304305
"""Run the unit test suite."""
306+
if session.python == "3.15":
307+
session.skip("Skipping 3.15 until wheels are available for pyarrow.")
305308

306309
# Compliance tests only run on the latest Python version
307310
if test_type == "compliance" and session.python != DEFAULT_PYTHON_VERSION:

packages/db-dtypes/testing/constraints-3.15.txt

Whitespace-only changes.

packages/django-google-spanner/noxfile.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"3.12",
3535
"3.13",
3636
"3.14",
37+
"3.15",
3738
]
3839
ALL_PYTHON = list(UNIT_TEST_PYTHON_VERSIONS)
3940

0 commit comments

Comments
 (0)