Skip to content
Draft
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
36 changes: 33 additions & 3 deletions .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ name: unittest
permissions:
contents: read


jobs:
unit:
runs-on: ubuntu-22.04
strategy:
fail-fast: true
matrix:
python: ['3.9', '3.10', "3.11", "3.12", "3.13", "3.14"]
python: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.15"]
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
Expand All @@ -32,18 +33,47 @@ jobs:
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: ${{ matrix.python }}
allow-prereleases: true
- name: Setup uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: 'packages/**/testing/constraints*.txt'
- name: Install nox
run: |
python -m pip install --upgrade setuptools pip wheel
python -m pip install nox
uv pip install --system nox nox-uv
# Caches compiled wheels locally to prevent building heavy libraries
# such as grpcio, which we build from scratch on every run for Python 3.15+.
# Follow https://github.com/grpc/grpc/issues/41010 for updates.
- name: Cache Built Python 3.15 Wheels
if: matrix.python == '3.15'
uses: actions/cache@v4
with:
path: .uv-wheel-cache
key: ${{ runner.os }}-uv-wheels-3.15-${{ hashFiles('packages/**/testing/constraints*.txt') }}
restore-keys: |
${{ runner.os }}-uv-wheels-3.15-
- name: Run unit tests
env:
COVERAGE_FILE: ${{ github.workspace }}/.coverage-${{ matrix.python }}
BUILD_TYPE: presubmit
TARGET_BRANCH: ${{ github.base_ref || github.event.merge_group.base_ref }}
TEST_TYPE: unit
PY_VERSION: ${{ matrix.python }}
# Workaround: Allows libcst to compile on Python 3.15+ while PyO3 catches up
# Can be removed once libcst releases a version with native Python 3.15 wheels
# Follow https://github.com/Instagram/LibCST/issues/1445 for updates.
PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1"
run: |
# Only inject overrides if we are strictly on the 3.15 pre-release
# This is needed to speed up builds
if [ "${{ matrix.python }}" = "3.15" ]; then
# Tell uv it is allowed to use the pre-release 3.15 toolchain
export UV_PRERELEASE="allow"

# Route uv's wheel and environment cache to our persistent workspace directory
export UV_CACHE_DIR="${{ github.workspace }}/.uv-wheel-cache"
fi
ci/run_conditional_tests.sh
- name: Upload coverage results
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
Expand Down
2 changes: 2 additions & 0 deletions .kokoro/presubmit/system.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ env_vars: {
key: "BIGFRAMES_TEST_PROJECT"
value: "bigframes-testing"
}

timeout_mins: 360
Original file line number Diff line number Diff line change
Expand Up @@ -357,52 +357,6 @@ replacements:

Quick Start
count: 1
- paths: [
packages/google-cloud-bigtable/mypy.ini
]
before: |
\[mypy\]
[\s\S]*?incremental = True
after: |
[mypy]
python_version = 3.13
namespace_packages = True
check_untyped_defs = True
warn_unreachable = True
disallow_any_generics = True
exclude = tests/unit/gapic/

[mypy-grpc.*]
ignore_missing_imports = True

[mypy-google.auth.*]
ignore_missing_imports = True

[mypy-google.iam.*]
ignore_missing_imports = True

[mypy-google.longrunning.*]
ignore_missing_imports = True

[mypy-google.oauth2.*]
ignore_missing_imports = True

[mypy-google.rpc.*]
ignore_missing_imports = True

[mypy-proto.*]
ignore_missing_imports = True

[mypy-pytest]
ignore_missing_imports = True

[mypy-google.cloud.*]
ignore_errors = True

# only verify data client
[mypy-google.cloud.bigtable.data.*]
ignore_errors = False
count: 1
# Note: noxfile.py is heavily customized so we clobber the whole file.
- paths: [
packages/google-cloud-bigtable/noxfile.py
Expand Down Expand Up @@ -431,6 +385,7 @@ replacements:
"3.12",
"3.13",
"3.14",
"3.15",
]

UNIT_TEST_STANDARD_DEPENDENCIES = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,42 +39,6 @@ replacements:
"google-cloud-core >= 2.0.0, <3.0.0",
"grpcio >= 1.59.0, < 2.0.0",
count: 1
- paths: [
"packages/google-cloud-datastore/mypy.ini",
]
before: |-
# Performance: reuse results from previous runs to speed up 'nox'
incremental = True
after: |-
# Performance: reuse results from previous runs to speed up "nox"
incremental = True

[mypy-google.cloud.datastore._app_engine_key_pb2]
ignore_errors = True

# TODO(https://github.com/googleapis/gapic-generator-python/issues/2410):
# Remove once this generator bug is fixed
[mypy-google.cloud.datastore_v1.services.datastore.async_client]
ignore_errors = True

# TODO(https://github.com/googleapis/gapic-generator-python/issues/2410):
# Remove once this generator bug is fixed
[mypy-google.cloud.datastore_v1.services.datastore.client]
ignore_errors = True
count: 1
- paths: [
"packages/google-cloud-datastore/mypy.ini",
]
before: |
ignore_missing_imports = False

# TODO\(https://github.com/googleapis/gapic-generator-python/issues/2563\):
# Dependencies that historically lacks py.typed markers
\[mypy-google\.iam\.\*\]
ignore_missing_imports = True
after: |
ignore_missing_imports = True
count: 1
- paths: [
"packages/google-cloud-datastore/docs/index.rst",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,7 @@ replacements:
"3.12",
"3.13",
"3.14",
"3.15",
]
UNIT_TEST_STANDARD_DEPENDENCIES = [
"mock",
Expand Down
5 changes: 5 additions & 0 deletions ci/run_single_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ case ${TEST_TYPE} in
nox -s unit-3.14
retval=$?
;;
"3.15")
# This is needed to speed up builds
nox --force-venv-backend uv -s unit-3.15
retval=$?
;;
*)
echo "unsupported PY_VERSION"
exit 1
Expand Down
2 changes: 1 addition & 1 deletion librarian.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
language: python
version: v0.22.0
version: v0.22.1-0.20260626155540-a0930f4b0f52
repo: googleapis/google-cloud-python
sources:
googleapis:
Expand Down
3 changes: 2 additions & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,5 @@ warn_unreachable = True
disallow_any_generics = True
ignore_errors = False


[mypy-google.cloud.datastore._app_engine_key_pb2]
ignore_errors = True
3 changes: 0 additions & 3 deletions packages/bigquery-magics/mypy.ini

This file was deleted.

1 change: 1 addition & 0 deletions packages/bigquery-magics/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"3.12",
"3.13",
"3.14",
"3.15",
]

UNIT_TEST_STANDARD_DEPENDENCIES = [
Expand Down
Empty file.
1 change: 1 addition & 0 deletions packages/db-dtypes/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"3.12",
"3.13",
"3.14",
"3.15",
]

UNIT_TEST_STANDARD_DEPENDENCIES = [
Expand Down
Empty file.
1 change: 1 addition & 0 deletions packages/django-google-spanner/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"3.12",
"3.13",
"3.14",
"3.15",
]
ALL_PYTHON = list(UNIT_TEST_PYTHON_VERSIONS)

Expand Down
Empty file.
2 changes: 0 additions & 2 deletions packages/gapic-generator/mypy.ini

This file was deleted.

15 changes: 13 additions & 2 deletions packages/gcp-sphinx-docfx-yaml/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,16 @@
import nox

DEFAULT_PYTHON_VERSION = "3.14"
UNIT_TEST_PYTHON_VERSIONS = ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
UNIT_TEST_PYTHON_VERSIONS = [
"3.8",
"3.9",
"3.10",
"3.11",
"3.12",
"3.13",
"3.14",
"3.15",
]
RUFF_VERSION = "ruff==0.14.14"

ALL_PYTHON = list(UNIT_TEST_PYTHON_VERSIONS)
Expand Down Expand Up @@ -138,7 +147,9 @@ def unit(session):
# Re-enable 3.8, 3.9, 3.11, 3.12, and 3.13 after environment verification.
# TODO(https://github.com/googleapis/google-cloud-python/issues/16176):
# Track 3.14 compatibility as upstream dependencies stabilize.
_skip_python_session(session, ["3.7", "3.8", "3.9", "3.11", "3.12", "3.13", "3.14"])
_skip_python_session(
session, ["3.7", "3.8", "3.9", "3.11", "3.12", "3.13", "3.14", "3.15"]
)
session.install("-r", "requirements.txt")
session.install("pytest", "pytest-cov")
session.run(
Expand Down
15 changes: 0 additions & 15 deletions packages/google-ads-admanager/mypy.ini

This file was deleted.

19 changes: 14 additions & 5 deletions packages/google-ads-admanager/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,24 @@
"3.12",
"3.13",
"3.14",
"3.15",
]

DEFAULT_PYTHON_VERSION = "3.14"

# TODO(https://github.com/googleapis/gapic-generator-python/issues/2450):
# Switch this to Python 3.15 alpha1
# https://peps.python.org/pep-0790/
PREVIEW_PYTHON_VERSION = "3.14"
PREVIEW_PYTHON_VERSION = "3.15"

CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
# Path to the centralized mypy configuration file at the repository root.
# Search upwards to support running nox from both monorepo packages and integration test goldens.
MYPY_CONFIG_FILE = next(
(
str(p / "mypy.ini")
for p in CURRENT_DIRECTORY.parents
if (p / "mypy.ini").exists()
),
str(CURRENT_DIRECTORY.parent.parent / "mypy.ini"),
)

if (CURRENT_DIRECTORY / "testing").exists():
LOWER_BOUND_CONSTRAINTS_FILE = (
Expand Down Expand Up @@ -107,6 +115,7 @@ def mypy(session):
session.install(".")
session.run(
"mypy",
f"--config-file={MYPY_CONFIG_FILE}",
"-p",
"google",
"--check-untyped-defs",
Expand Down Expand Up @@ -566,7 +575,7 @@ def prerelease_deps(session, protobuf_implementation):
)


@nox.session(python=DEFAULT_PYTHON_VERSION)
@nox.session(python=PREVIEW_PYTHON_VERSION)
@nox.parametrize(
"protobuf_implementation",
["python", "upb"],
Expand Down
12 changes: 12 additions & 0 deletions packages/google-ads-admanager/testing/constraints-3.15.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# We use the constraints file for the latest Python version
# (currently this file) to check that the latest
# major versions of dependencies are supported in setup.py.
# List all library dependencies and extras in this file.
# Require the latest major version be installed for each dependency.
# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0",
# Then this file should have google-cloud-foo>=1
google-api-core>=2
google-auth>=2
grpcio>=1
proto-plus>=1
protobuf>=7
Original file line number Diff line number Diff line change
Expand Up @@ -1607,6 +1607,9 @@ def test_list_ad_breaks_rest_pager(transport: str = "rest"):

pager = client.list_ad_breaks(request=sample_request)

assert pager.next_page_token == "abc"
assert str(pager).startswith(f"{pager.__class__.__name__}<")

results = list(pager)
assert len(results) == 6
assert all(isinstance(i, ad_break_messages.AdBreak) for i in results)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1488,6 +1488,9 @@ def test_search_ad_review_center_ads_rest_pager(transport: str = "rest"):

pager = client.search_ad_review_center_ads(request=sample_request)

assert pager.next_page_token == "abc"
assert str(pager).startswith(f"{pager.__class__.__name__}<")

results = list(pager)
assert len(results) == 6
assert all(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1595,6 +1595,9 @@ def test_list_ad_units_rest_pager(transport: str = "rest"):

pager = client.list_ad_units(request=sample_request)

assert pager.next_page_token == "abc"
assert str(pager).startswith(f"{pager.__class__.__name__}<")

results = list(pager)
assert len(results) == 6
assert all(isinstance(i, ad_unit_messages.AdUnit) for i in results)
Expand Down Expand Up @@ -1859,6 +1862,9 @@ def test_list_ad_unit_sizes_rest_pager(transport: str = "rest"):

pager = client.list_ad_unit_sizes(request=sample_request)

assert pager.next_page_token == "abc"
assert str(pager).startswith(f"{pager.__class__.__name__}<")

results = list(pager)
assert len(results) == 6
assert all(isinstance(i, ad_unit_messages.AdUnitSize) for i in results)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1625,6 +1625,9 @@ def test_list_applications_rest_pager(transport: str = "rest"):

pager = client.list_applications(request=sample_request)

assert pager.next_page_token == "abc"
assert str(pager).startswith(f"{pager.__class__.__name__}<")

results = list(pager)
assert len(results) == 6
assert all(isinstance(i, application_messages.Application) for i in results)
Expand Down
Loading
Loading