diff --git a/.github/workflows/gapic-generator-tests.yml b/.github/workflows/gapic-generator-tests.yml index b557a331cf6b..f6a47939fc64 100644 --- a/.github/workflows/gapic-generator-tests.yml +++ b/.github/workflows/gapic-generator-tests.yml @@ -18,7 +18,13 @@ env: SHOWCASE_VERSION: 0.35.0 PROTOC_VERSION: 3.20.2 LATEST_STABLE_PYTHON: 3.14 - ALL_PYTHON: "['3.10', '3.11', '3.12', '3.13', '3.14']" + PRERELEASE_PYTHON: 3.15 + ALL_PYTHON: "['3.10', '3.11', '3.12', '3.13', '3.14', '3.15']" + TRIMMED_PYTHON: "['3.10', '3.14', '3.15']" + # 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" jobs: check_changes: @@ -47,6 +53,8 @@ jobs: outputs: all_python: ${{ env.ALL_PYTHON }} latest_stable_python: ${{ env.LATEST_STABLE_PYTHON }} + prerelease_python: ${{ env.PRERELEASE_PYTHON }} + trimmed_python: $${{ env.TRIMMED_PYTHON }} steps: - run: echo "Initializing config for gapic-generator" @@ -65,6 +73,12 @@ jobs: uses: actions/setup-python@v6 with: python-version: "${{ matrix.python }}" + allow-prereleases: true + # 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. + cache: 'pip' + cache-dependency-path: '**/requirements*.txt' - name: Install System Deps & Protoc run: | sudo apt-get update && sudo apt-get install -y curl pandoc unzip @@ -132,10 +146,16 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - - name: Set up Python + - name: Set up Python ${{ needs.python_config.outputs.prerelease_python }} uses: actions/setup-python@v6 with: - python-version: ${{ needs.python_config.outputs.latest_stable_python }} + python-version: ${{ needs.python_config.outputs.prerelease_python }} + allow-prereleases: true + # 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. + cache: 'pip' + cache-dependency-path: '**/requirements*.txt' - name: Install System Deps run: sudo apt-get update && sudo apt-get install -y pandoc - name: Run Goldens (Prerelease) @@ -150,7 +170,7 @@ jobs: needs: python_config strategy: matrix: - python: ["3.10", "3.14"] + python: ${{ fromJSON(needs.python_config.outputs.trimmed_python) }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 @@ -158,7 +178,12 @@ jobs: uses: actions/setup-python@v6 with: python-version: ${{ matrix.python }} - # This fixes the Pandoc error + allow-prereleases: true + # 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. + cache: 'pip' + cache-dependency-path: '**/requirements*.txt' - name: Install System Deps & Protoc run: | sudo apt-get update && sudo apt-get install -y curl pandoc unzip diff --git a/packages/gapic-generator/gapic/templates/noxfile.py.j2 b/packages/gapic-generator/gapic/templates/noxfile.py.j2 index c240871b994e..a59d98087467 100644 --- a/packages/gapic-generator/gapic/templates/noxfile.py.j2 +++ b/packages/gapic-generator/gapic/templates/noxfile.py.j2 @@ -30,14 +30,12 @@ ALL_PYTHON = [ "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() @@ -567,7 +565,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"], diff --git a/packages/gapic-generator/gapic/templates/testing/constraints-3.15.txt.j2 b/packages/gapic-generator/gapic/templates/testing/constraints-3.15.txt.j2 new file mode 100644 index 000000000000..a2e0a3f4cb1e --- /dev/null +++ b/packages/gapic-generator/gapic/templates/testing/constraints-3.15.txt.j2 @@ -0,0 +1,21 @@ +{% from '_pypi_packages.j2' import pypi_packages %} +# 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 +{% for package_tuple, package_info in pypi_packages.items() %} +{# Quick check to make sure `package_info.package_name` is not the package being generated so we don't circularly include this package in its own constraints file. #} +{% if api.naming.warehouse_package_name != package_info.package_name %} +{% if api.requires_package(package_tuple) %} +{{ package_info.package_name }}>={{ (package_info.upper_bound.split(".")[0] | int) - 1 }} +{% endif %} +{% endif %} +{% endfor %} diff --git a/packages/gapic-generator/noxfile.py b/packages/gapic-generator/noxfile.py index 8ef965740c2b..84d273023968 100644 --- a/packages/gapic-generator/noxfile.py +++ b/packages/gapic-generator/noxfile.py @@ -50,9 +50,10 @@ "3.12", "3.13", "3.14", + "3.15", ) -NEWEST_PYTHON = ALL_PYTHON[-1] +NEWEST_PYTHON = ALL_PYTHON[-2] @nox.session(python=ALL_PYTHON) diff --git a/packages/gapic-generator/tests/integration/goldens/asset/noxfile.py b/packages/gapic-generator/tests/integration/goldens/asset/noxfile.py index 93e185b59d11..58ded83c89ac 100755 --- a/packages/gapic-generator/tests/integration/goldens/asset/noxfile.py +++ b/packages/gapic-generator/tests/integration/goldens/asset/noxfile.py @@ -37,14 +37,12 @@ "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() @@ -559,7 +557,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"], diff --git a/packages/gapic-generator/tests/integration/goldens/asset/testing/constraints-3.15.txt b/packages/gapic-generator/tests/integration/goldens/asset/testing/constraints-3.15.txt new file mode 100755 index 000000000000..f63842dab6f9 --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/asset/testing/constraints-3.15.txt @@ -0,0 +1,15 @@ +# 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 +google-cloud-access-context-manager>=0 +google-cloud-os-config>=1 +grpc-google-iam-v1>=0 diff --git a/packages/gapic-generator/tests/integration/goldens/credentials/noxfile.py b/packages/gapic-generator/tests/integration/goldens/credentials/noxfile.py index c991842b24ca..af6482e5ff68 100755 --- a/packages/gapic-generator/tests/integration/goldens/credentials/noxfile.py +++ b/packages/gapic-generator/tests/integration/goldens/credentials/noxfile.py @@ -37,14 +37,12 @@ "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() @@ -559,7 +557,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"], diff --git a/packages/gapic-generator/tests/integration/goldens/credentials/testing/constraints-3.15.txt b/packages/gapic-generator/tests/integration/goldens/credentials/testing/constraints-3.15.txt new file mode 100755 index 000000000000..6bd7e1f5b03d --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/credentials/testing/constraints-3.15.txt @@ -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 diff --git a/packages/gapic-generator/tests/integration/goldens/eventarc/noxfile.py b/packages/gapic-generator/tests/integration/goldens/eventarc/noxfile.py index 1ec5368a9dd4..9f89e95f5237 100755 --- a/packages/gapic-generator/tests/integration/goldens/eventarc/noxfile.py +++ b/packages/gapic-generator/tests/integration/goldens/eventarc/noxfile.py @@ -37,14 +37,12 @@ "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() @@ -559,7 +557,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"], diff --git a/packages/gapic-generator/tests/integration/goldens/eventarc/testing/constraints-3.15.txt b/packages/gapic-generator/tests/integration/goldens/eventarc/testing/constraints-3.15.txt new file mode 100755 index 000000000000..f85022a2fb62 --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/eventarc/testing/constraints-3.15.txt @@ -0,0 +1,13 @@ +# 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 +grpc-google-iam-v1>=0 diff --git a/packages/gapic-generator/tests/integration/goldens/logging/noxfile.py b/packages/gapic-generator/tests/integration/goldens/logging/noxfile.py index 448aec3ef2b0..dfe763b3d029 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging/noxfile.py +++ b/packages/gapic-generator/tests/integration/goldens/logging/noxfile.py @@ -37,14 +37,12 @@ "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() @@ -559,7 +557,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"], diff --git a/packages/gapic-generator/tests/integration/goldens/logging/testing/constraints-3.15.txt b/packages/gapic-generator/tests/integration/goldens/logging/testing/constraints-3.15.txt new file mode 100755 index 000000000000..6bd7e1f5b03d --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging/testing/constraints-3.15.txt @@ -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 diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/noxfile.py b/packages/gapic-generator/tests/integration/goldens/logging_internal/noxfile.py index 448aec3ef2b0..dfe763b3d029 100755 --- a/packages/gapic-generator/tests/integration/goldens/logging_internal/noxfile.py +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/noxfile.py @@ -37,14 +37,12 @@ "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() @@ -559,7 +557,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"], diff --git a/packages/gapic-generator/tests/integration/goldens/logging_internal/testing/constraints-3.15.txt b/packages/gapic-generator/tests/integration/goldens/logging_internal/testing/constraints-3.15.txt new file mode 100755 index 000000000000..6bd7e1f5b03d --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/logging_internal/testing/constraints-3.15.txt @@ -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 diff --git a/packages/gapic-generator/tests/integration/goldens/redis/noxfile.py b/packages/gapic-generator/tests/integration/goldens/redis/noxfile.py index d860093c9653..deedbe421748 100755 --- a/packages/gapic-generator/tests/integration/goldens/redis/noxfile.py +++ b/packages/gapic-generator/tests/integration/goldens/redis/noxfile.py @@ -37,14 +37,12 @@ "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() @@ -559,7 +557,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"], diff --git a/packages/gapic-generator/tests/integration/goldens/redis/testing/constraints-3.15.txt b/packages/gapic-generator/tests/integration/goldens/redis/testing/constraints-3.15.txt new file mode 100755 index 000000000000..6bd7e1f5b03d --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/redis/testing/constraints-3.15.txt @@ -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 diff --git a/packages/gapic-generator/tests/integration/goldens/redis_selective/noxfile.py b/packages/gapic-generator/tests/integration/goldens/redis_selective/noxfile.py index d860093c9653..deedbe421748 100755 --- a/packages/gapic-generator/tests/integration/goldens/redis_selective/noxfile.py +++ b/packages/gapic-generator/tests/integration/goldens/redis_selective/noxfile.py @@ -37,14 +37,12 @@ "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() @@ -559,7 +557,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"], diff --git a/packages/gapic-generator/tests/integration/goldens/redis_selective/testing/constraints-3.15.txt b/packages/gapic-generator/tests/integration/goldens/redis_selective/testing/constraints-3.15.txt new file mode 100755 index 000000000000..6bd7e1f5b03d --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/redis_selective/testing/constraints-3.15.txt @@ -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 diff --git a/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/noxfile.py b/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/noxfile.py index 9afec5aeae68..ea0dffab5b4c 100755 --- a/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/noxfile.py +++ b/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/noxfile.py @@ -37,14 +37,12 @@ "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() @@ -559,7 +557,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"], diff --git a/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/testing/constraints-3.15.txt b/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/testing/constraints-3.15.txt new file mode 100755 index 000000000000..6bd7e1f5b03d --- /dev/null +++ b/packages/gapic-generator/tests/integration/goldens/storagebatchoperations/testing/constraints-3.15.txt @@ -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