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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 6 additions & 17 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ concurrency:
env:
SHOWCASE_VERSION: 0.35.0
PROTOC_VERSION: 3.20.2
OLDEST_PYTHON: 3.7
OLDEST_PYTHON: 3.9
LATEST_STABLE_PYTHON: 3.14
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2450):
# Switch this to Python 3.15 alpha1 pre-release
Expand All @@ -25,7 +25,7 @@ env:
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2450):
# Add Python 3.15 alpha1 pre-release
# https://peps.python.org/pep-0790/
ALL_PYTHON: "['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14']"
ALL_PYTHON: "['3.9', '3.10', '3.11', '3.12', '3.13', '3.14']"

permissions:
contents: read
Expand Down Expand Up @@ -93,9 +93,6 @@ jobs:
# Run mypy on all of the supported python versions listed in setup.py
# https://github.com/python/mypy/blob/master/setup.py
python: ${{ fromJSON(needs.all_python_setup.outputs.all_python) }}
exclude:
# Remove once https://github.com/googleapis/gapic-generator-python/issues/2303 is fixed
- python: '3.7'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
Expand All @@ -119,9 +116,7 @@ jobs:
target: [showcase, showcase_w_rest_async]
logging_scope: ["", "google"]

# TODO(https://github.com/googleapis/gapic-generator-python/issues/2303): use `ubuntu-latest` once this bug is fixed.
# Use ubuntu-22.04 until Python 3.7 is removed from the test matrix
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python "${{ matrix.python }}"
Expand Down Expand Up @@ -212,9 +207,7 @@ jobs:
variant: ['', _alternative_templates, _mixins, _alternative_templates_mixins, _w_rest_async]
logging_scope: ["", "google"]

# TODO(https://github.com/googleapis/gapic-generator-python/issues/2303): use `ubuntu-latest` once this bug is fixed.
# Use ubuntu-22.04 until Python 3.7 is removed from the test matrix
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python "${{ matrix.python }}"
Expand Down Expand Up @@ -318,9 +311,7 @@ jobs:
strategy:
matrix:
python: ${{ fromJSON(needs.all_python_setup.outputs.all_python) }}
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2303): use `ubuntu-latest` once this bug is fixed.
# Use ubuntu-22.04 until Python 3.7 is removed from the test matrix
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python ${{ matrix.python }}
Expand All @@ -344,9 +335,7 @@ jobs:
matrix:
python: ${{ fromJSON(needs.all_python_setup.outputs.all_python) }}
variant: ['', _alternative_templates]
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2303): use `ubuntu-latest` once this bug is fixed.
# Use ubuntu-22.04 until Python 3.7 is removed from the test matrix
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python ${{ matrix.python }}
Expand Down
2 changes: 1 addition & 1 deletion DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

Execute unit tests by running one of the sessions prefixed with `unit-`.

- Example: `nox -s unit-3.8`
- Example: `nox -s unit-3.13`
- See all Nox sessions with `nox -l`.

## Formatting
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ API Client Generator for Python

|release level| |pypi| |versions|

A generator for protocol buffer described APIs for and in Python 3.
A client library generator for APIs described through protocol buffers.

This is a generator for API client libraries for APIs
specified by `protocol buffers`_, such as those inside Google.
Expand Down
2 changes: 0 additions & 2 deletions gapic/ads-templates/noxfile.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import nox # type: ignore
# Add tests for Python 3.15 alpha1
# https://peps.python.org/pep-0790/
ALL_PYTHON = [
"3.7",
"3.8",
"3.9",
"3.10",
"3.11",
Expand Down
5 changes: 2 additions & 3 deletions gapic/ads-templates/setup.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ dependencies = [
"googleapis-common-protos >= 1.53.0",
"grpcio >= 1.10.0",
"proto-plus >= 1.22.3, <2.0.0",
"protobuf >= 4.25.8, <7.0.0",
{% if api.requires_package(('google', 'iam', 'v1')) %}
"grpc-google-iam-v1",
{% endif %}
Expand Down Expand Up @@ -63,8 +64,6 @@ setuptools.setup(
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand All @@ -76,7 +75,7 @@ setuptools.setup(
],
platforms="Posix; MacOS X; Windows",
packages=packages,
python_requires=">=3.7",
python_requires=">=3.9",
install_requires=dependencies,
include_package_data=True,
zip_safe=False,
Expand Down
6 changes: 2 additions & 4 deletions gapic/templates/noxfile.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ if os.path.isdir("samples"):
FORMAT_PATHS.append("samples")

ALL_PYTHON = [
"3.7",
"3.8",
"3.9",
"3.10",
"3.11",
Expand Down Expand Up @@ -287,7 +285,7 @@ def unit(session, protobuf_implementation):


def install_systemtest_dependencies(session, *constraints):
session.install("--pre", "grpcio")
session.install("--pre", "grpcio<=1.62.2")

session.install(*SYSTEM_TEST_STANDARD_DEPENDENCIES, *constraints)

Expand Down Expand Up @@ -506,7 +504,7 @@ def prerelease_deps(session, protobuf_implementation):
"google-api-core",
"google-auth",
"grpc-google-iam-v1",
"grpcio",
"grpcio<=1.62.2",
"grpcio-status",
"protobuf",
"proto-plus",
Expand Down
8 changes: 3 additions & 5 deletions gapic/templates/setup.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ else:
release_status = "Development Status :: 5 - Production/Stable"

dependencies = [
"google-api-core[grpc] >= 1.34.1, <3.0.0,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*",
"google-api-core[grpc] >= 2.11.0, <3.0.0",
# Exclude incompatible versions of `google-auth`
# See https://github.com/googleapis/google-cloud-python/issues/12364
"google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0",
Expand All @@ -42,7 +42,7 @@ dependencies = [
"proto-plus >= 1.22.3, <2.0.0",
"proto-plus >= 1.25.0, <2.0.0; python_version >= '3.13'",
{# Explicitly exclude protobuf versions mentioned in https://cloud.google.com/support/bulletins#GCP-2022-019 #}
"protobuf>=3.20.2,<7.0.0,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5",
"protobuf >= 4.25.8, <7.0.0",
{% 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 %}
Expand Down Expand Up @@ -89,8 +89,6 @@ setuptools.setup(
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand All @@ -102,7 +100,7 @@ setuptools.setup(
],
platforms="Posix; MacOS X; Windows",
packages=packages,
python_requires=">=3.7",
python_requires=">=3.9",
install_requires=dependencies,
extras_require=extras,
include_package_data=True,
Expand Down
21 changes: 0 additions & 21 deletions gapic/templates/testing/constraints-3.7.txt.j2

This file was deleted.

4 changes: 0 additions & 4 deletions gapic/templates/testing/constraints-3.8.txt.j2

This file was deleted.

24 changes: 21 additions & 3 deletions gapic/templates/testing/constraints-3.9.txt.j2
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
# -*- coding: utf-8 -*-
{% block constraints %}
{% include "testing/_default_constraints.j2" %}
{% endblock %}
{% from '_pypi_packages.j2' import pypi_packages %}
# This constraints file is used to check that lower bounds
# are correct in setup.py
# List all library dependencies and extras in this file,
# pinning their versions to their lower bounds.
# For example, if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0",
# then this file should have google-cloud-foo==1.14.0
google-api-core==2.11.0
google-auth==2.35.0
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2453)
# Add the minimum supported version of grpcio to constraints files
proto-plus==1.22.3
protobuf==4.25.8
{% 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.lower_bound }}
{% endif %}
{% endif %}
{% endfor %}
104 changes: 30 additions & 74 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
BLACK_EXCLUDES = "|".join([".*golden.*", ".*pb2.py"])

ALL_PYTHON = (
"3.7",
"3.8",
"3.9",
"3.10",
"3.11",
Expand Down Expand Up @@ -170,17 +168,13 @@ def fragment(session, use_ads_templates=False):
"pytest",
"pytest-cov",
"pytest-xdist",
"asyncmock; python_version < '3.8'",
"pytest-asyncio",
"grpcio-tools",
)
session.install("-e", ".")

# TODO(https://github.com/googleapis/gapic-generator-python/issues/2473):
# Warnings emitted from google-api-core starting in 2.28
# appear to cause issues when running protoc.
# The specific failure is `Plugin output is unparseable`
if session.python in ("3.7", "3.8", "3.9", "3.10"):
if session.python in ("3.9", "3.10"):
session.install("google-api-core<2.28")

frag_files = (
Expand Down Expand Up @@ -250,7 +244,7 @@ def showcase_library(
# Warnings emitted from google-api-core starting in 2.28
# appear to cause issues when running protoc.
# The specific failure is `Plugin output is unparseable`
if session.python in ("3.7", "3.8", "3.9", "3.10"):
if session.python in ("3.9", "3.10"):
session.install("google-api-core<2.28")

# Install a client library for Showcase.
Expand Down Expand Up @@ -357,40 +351,20 @@ def showcase_library(
f"{tmp_dir}/testing/constraints-{session.python}.txt"
)
# Install the library with a constraints file.
if session.python == "3.7":
session.install("-e", tmp_dir, "-r", constraints_path)
if rest_async_io_enabled:
# NOTE: We re-install `google-api-core` and `google-auth` to override the respective
# versions for each specified in constraints-3.7.txt. This is needed because async REST
# is not supported with the minimum version of `google-api-core` and `google-auth`.
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2211): Remove hardcoded dependencies
# from here and add a new constraints file for testing the minimum supported versions for async REST feature.
session.install(
"--no-cache-dir",
"--force-reinstall",
"google-api-core[grpc, async_rest]==2.21.0",
)
# session.install('--no-cache-dir', '--force-reinstall', "google-api-core==2.20.0")
session.install(
"--no-cache-dir",
"--force-reinstall",
"google-auth[aiohttp]==2.35.0",
)
else:
session.install(
"-e",
tmp_dir + ("[async_rest]" if rest_async_io_enabled else ""),
"-r",
constraints_path,
)
# Exclude `google-auth==2.40.0` which contains a regression
# https://github.com/googleapis/gapic-generator-python/issues/2385
session.install(
"--no-cache-dir",
"--force-reinstall",
"--upgrade",
"google-auth[aiohttp]!=2.40.0",
)
session.install(
"-e",
tmp_dir + ("[async_rest]" if rest_async_io_enabled else ""),
"-r",
constraints_path,
)
# Exclude `google-auth==2.40.0` which contains a regression
# https://github.com/googleapis/gapic-generator-python/issues/2385
session.install(
"--no-cache-dir",
"--force-reinstall",
"--upgrade",
"google-auth[aiohttp]!=2.40.0",
)
else:
# The ads templates do not have constraints files.
# See https://github.com/googleapis/gapic-generator-python/issues/1788
Expand Down Expand Up @@ -497,41 +471,23 @@ def run_showcase_unit_tests(session, fail_under=100, rest_async_io_enabled=False
"pytest",
"pytest-cov",
"pytest-xdist",
"asyncmock; python_version < '3.8'",
"pytest-asyncio",
)
# Run the tests.
# NOTE: async rest is not supported against the minimum supported version of google-api-core.
# Therefore, we ignore the coverage requirement in this case.
if session.python == "3.7" and rest_async_io_enabled:
session.run(
"py.test",
*(
session.posargs
or [
"-n=auto",
"--quiet",
"--cov=google",
"--cov-append",
path.join("tests", "unit"),
]
),
)
else:
session.run(
"py.test",
*(
session.posargs
or [
"-n=auto",
"--quiet",
"--cov=google",
"--cov-append",
f"--cov-fail-under={str(fail_under)}",
path.join("tests", "unit"),
]
),
)
session.run(
"py.test",
*(
session.posargs
or [
"-n=auto",
"--quiet",
"--cov=google",
"--cov-append",
f"--cov-fail-under={str(fail_under)}",
path.join("tests", "unit"),
]
),
)


@nox.session(python=ALL_PYTHON)
Expand Down
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ google-api-core
googleapis-common-protos
jinja2
MarkupSafe
protobuf
protobuf>=4.25.8
pypandoc
PyYAML
grpc-google-iam-v1
Expand Down
Loading
Loading