Skip to content

Conversation

@vchudnov-g
Copy link
Contributor

No description provided.

@product-auto-label product-auto-label bot added the size: xl Pull request size is extra large. label Dec 8, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @vchudnov-g, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request updates the project's minimum Python version requirement from 3.7 to 3.9. This change is consistently applied across the project's configuration, including the setup.py for package distribution, noxfile.py for development and testing environments, and DEVELOPMENT.md for documentation. The primary goal is to streamline development by leveraging features available in newer Python versions and to discontinue support for older, potentially less maintained, versions.

Highlights

  • Minimum Python Version: The project now officially requires Python 3.9 or newer, discontinuing support for Python 3.7 and 3.8.
  • Development Environment Updates: The Nox testing configuration has been updated to remove Python 3.7 and 3.8 from the test matrix, and the development documentation now reflects an example for Python 3.13.
  • Package Metadata Alignment: The setup.py file has been updated to reflect the new minimum Python requirement in its classifiers and the python_requires field.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/tests.yaml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@vchudnov-g vchudnov-g changed the title chore: require Python ≥3.9 chore: require Python ≥ 3.9 Dec 8, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request begins the process of requiring Python 3.9 or newer by updating DEVELOPMENT.md, noxfile.py, and setup.py. The changes made are correct, but the effort is incomplete. The update to noxfile.py leaves behind several blocks of obsolete code that were specific to the now-unsupported Python 3.7 and 3.8 versions. Additionally, crucial template files like gapic/templates/noxfile.py.j2 and gapic/templates/setup.py.j2 have not been updated, meaning newly generated clients will not reflect the new minimum Python version. I've left a specific comment on noxfile.py and recommend updating the template files to complete this change.

I am having trouble creating individual review comments. Click here to see my feedback.

noxfile.py (40-41)

high

While removing Python 3.7 and 3.8 from ALL_PYTHON is correct, there are several other places in this file that have conditional logic for these older Python versions. Now that they are no longer supported, this code is obsolete and should be removed to improve maintainability.

Specifically, please check:

  • Line 167: "asyncmock; python_version < '3.8'"
  • Lines 340-358: The if session.python == "3.7": block.
  • Line 480: "asyncmock; python_version < '3.8'"
  • Lines 486-499: The if session.python == "3.7" and rest_async_io_enabled: block.

@product-auto-label product-auto-label bot added size: m Pull request size is medium. and removed size: xl Pull request size is extra large. labels Dec 8, 2025
@vchudnov-g
Copy link
Contributor Author

/gemini Why is "Tests / fragment (3.12)" failing? It passes locally on my machine.

@gemini-code-assist
Copy link
Contributor

Hello @vchudnov-g, thanks for reaching out! Regarding the "Tests / fragment (3.12)" failing, it appears to be related to a change in noxfile.py concerning the google-api-core dependency.

In the noxfile.py, specifically within the fragment session (and showcase_library session), there was a conditional installation of google-api-core<2.28 for certain Python versions. This was to address a known issue where "Warnings emitted from google-api-core starting in 2.28 appear to cause issues when running protoc," leading to a "Plugin output is unparseable" failure.

Previously, this constraint was applied to Python versions 3.7, 3.8, 3.9, and 3.10. With the changes in this PR, the constraint is now only applied to Python 3.9 and 3.10 (see noxfile.py lines 174-176 in the new code):

    # The specific failure is `Plugin output is unparseable`
    if session.python in ("3.9", "3.10"):
        session.install("google-api-core<2.28")

This means that for Python 3.11 and 3.12, the google-api-core<2.28 constraint is no longer enforced. If the underlying issue with protoc and google-api-core versions >= 2.28 still affects Python 3.12 in the CI environment, it would explain why the test is now failing for that specific version.

To debug this, I recommend checking the CI logs for the "Tests / fragment (3.12)" job to see:

  1. The exact version of google-api-core that is being installed for Python 3.12.
  2. Any error messages related to protoc or "Plugin output is unparseable."

If the issue persists, you might need to either:

  • Extend the google-api-core<2.28 constraint to include Python 3.12 in noxfile.py if the problem is still present with newer google-api-core versions.
  • Investigate if there's a newer version of google-api-core or protoc that resolves this incompatibility for Python 3.12, which might be what you have locally.

@vchudnov-g
Copy link
Contributor Author

/gemini The error does not seem to be coming from that cause. A typical error message is this:

nox > python -m grpc_tools.protoc --proto_path=tests/fragments --python_gapic_out=/tmp/tmpk9tuv5am --python_gapic_opt=transport=grpc+rest,python-gapic-templates=/home/runner/work/gapic-generator-python/gapic-generator-python/gapic/ads-templates,old-naming test_extended_operation_forwardcompat_lro.proto
nox > Command python -m grpc_tools.protoc --proto_path=tests/fragments --python_gapic_out=/tmp/tmpk9tuv5am --python_gapic_opt=transport=grpc+rest,python-gapic-templates=/home/runner/work/gapic-generator-python/gapic-generator-python/gapic/ads-templates,old-naming test_extended_operation_forwardcompat_lro.proto failed with exit code 1:
nox > protoc-gen-python_gapic: program not found or is not executable
Please specify a program using absolute path or make sure the program is available in your PATH system variable
--python_gapic_out: protoc-gen-python_gapic: Plugin failed with status code 1.

What could be causing this new error in this PR, given that tests were passing at HEAD?

@gemini-code-assist
Copy link
Contributor

Thanks for providing the detailed error message, @vchudnov-g! That clarifies the situation significantly, and you are absolutely right that my previous assessment about google-api-core was incorrect given this new information.

The error protoc-gen-python_gapic: program not found or is not executable indicates that the protoc compiler cannot find the python_gapic plugin. This plugin is provided by the gapic-generator-python package itself (the project you are working on).

Looking at the changes in noxfile.py for the fragment session (specifically DIFF 2), it appears that the line session.install("-e", ".") was removed. This line is crucial because it installs the current project (gapic-generator-python) into the Nox session's virtual environment in editable mode. Without this installation, the protoc-gen-python_gapic executable (which is part of this project) is not available in the environment's PATH, leading to the "program not found" error.

To resolve this, please re-add session.install("-e", ".") to the fragment session in noxfile.py.

Here's a suggested change:

        "grpcio-tools",
    )
    session.install("-e", ".")
    # The specific failure is `Plugin output is unparseable`
    if session.python in ("3.9", "3.10"):
        session.install("google-api-core<2.28")

This should make the protoc-gen-python_gapic plugin available to protoc within the Nox environment and resolve the failing test.

@product-auto-label product-auto-label bot added size: l Pull request size is large. and removed size: m Pull request size is medium. labels Dec 9, 2025
@vchudnov-g
Copy link
Contributor Author

/gemini Why is fragment-3.9 check failing? Where is the dependency conflict coming from?

@gemini-code-assist
Copy link
Contributor

Thanks for the update, @vchudnov-g. It's good to hear that the protoc-gen-python_gapic issue might be resolved. The new error indicating a "dependency conflict" for fragment-3.9 points to a different problem.

Based on the changes in this PR, the most likely source of the dependency conflict is the interaction between two specific requirements:

  1. google-api-core<2.28: This constraint is explicitly applied in noxfile.py for Python versions 3.9 and 3.10 within the fragment session (and showcase_library session). This was originally put in place to avoid a "Plugin output is unparseable" error with protoc when using google-api-core versions >=2.28.
  2. protobuf >= 4.25.8: This is the new minimum protobuf version required by the project, as updated in setup.py and requirements.in.

While the direct dependency ranges of google-api-core (e.g., 2.27.0 requires protobuf >= 3.19.5, < 5.0.0) and the project's protobuf requirement (>= 4.25.8, < 7.0.0) appear compatible on the surface, pip might be encountering a conflict due to a more complex transitive dependency graph or subtle incompatibilities between older google-api-core versions and the newer protobuf version (4.25.8). It's possible that a sub-dependency of google-api-core<2.28 has a stricter upper bound on protobuf that is violated by 4.25.8.

To pinpoint the exact conflict, I recommend examining the detailed logs from the fragment-3.9 Nox session. Look for messages from pip during the installation phase that explicitly state which packages are conflicting and why. This output will be crucial for understanding the precise nature of the incompatibility.

Once you have the detailed error from pip, we can better assess the best path forward, which might involve:

  • Investigating if newer versions of google-api-core (i.e., >=2.28) are now compatible with protobuf >= 4.25.8 and no longer cause the protoc issue (perhaps due to updates in protoc or grpcio-tools).
  • Adjusting the protobuf requirement for the fragment session if a compatible range can be found that satisfies both google-api-core<2.28 and the project's needs.

@vchudnov-g
Copy link
Contributor Author

/gemini This is the error message about the dependency conflict:

  nox -s fragment-3.9
  shell: /usr/bin/bash -e {0}
  env:
    SHOWCASE_VERSION: 0.35.0
    PROTOC_VERSION: 3.20.2
    OLDEST_PYTHON: 3.9
    LATEST_STABLE_PYTHON: 3.14
    PREVIEW_PYTHON_VERSION: 3.14
    ALL_PYTHON: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
    pythonLocation: /opt/hostedtoolcache/Python/3.9.25/x64
    PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.9.25/x64/lib/pkgconfig
    Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.25/x64
    Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.25/x64
    Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.25/x64
    LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.25/x64/lib
nox > Running session fragment-3.9
nox > Creating virtual environment (virtualenv) using python3.9 in .nox/fragment-3-9
nox > python -m pip install coverage pytest pytest-cov pytest-xdist pytest-asyncio grpcio-tools
nox > python -m pip install -e .
nox > python -m pip install 'google-api-core<2.28'
nox > python -m grpc_tools.protoc --proto_path=tests/fragments --python_gapic_out=/tmp/tmp0vr9__1f --python_gapic_opt=transport=grpc+rest,python-gapic-templates=DEFAULT test_extended_operation_forwardcompat_lro.proto
nox > python -m pip install /tmp/tmp0vr9__1f -e . -qqq -r /tmp/tmp0vr9__1f/testing/constraints-3.9.txt
nox > Command python -m pip install /tmp/tmp0vr9__1f -e . -qqq -r /tmp/tmp0vr9__1f/testing/constraints-3.9.txt failed with exit code 1:
nox > ERROR: Cannot install -r /tmp/tmp0vr9__1f/testing/constraints-3.9.txt (line 8), gapic-generator==1.30.0, google-fragment==0.0.0 and protobuf==4.25.8 because these package versions have conflicting dependencies.
ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

nox > Session fragment-3.9 failed.

@gemini-code-assist
Copy link
Contributor

Thanks for providing the detailed error message, @vchudnov-g. This clarifies the dependency conflict for fragment-3.9.

The error message:

ERROR: Cannot install -r /tmp/tmp0vr9__1f/testing/constraints-3.9.txt (line 8), gapic-generator==1.30.0, google-fragment==0.0.0 and protobuf==4.25.8 because these package versions have conflicting dependencies.
ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

This indicates a conflict primarily between google-api-core==1.34.1 (which is on line 8 of constraints-3.9.txt) and protobuf==4.25.8 (which is also explicitly set in constraints-3.9.txt and required by the main project and generated client).

While google-api-core 1.34.1's direct dependency on protobuf (>=3.19.5, <5.0.0) appears compatible with protobuf 4.25.8, this ResolutionImpossible error usually means that a transitive dependency of google-api-core==1.34.1 has a stricter upper bound on protobuf that conflicts with 4.25.8.

To resolve this, I recommend the following steps:

  1. Identify the exact transitive conflict:

    • In a local environment (or by examining the pip logs more closely), try to install google-api-core==1.34.1 and protobuf==4.25.8 together. Use tools like pipdeptree or pip check to inspect the full dependency graph and pinpoint which specific sub-dependency of google-api-core==1.34.1 is imposing an incompatible protobuf version.
  2. Re-evaluate the google-api-core<2.28 constraint:

    • The google-api-core<2.28 constraint in noxfile.py was introduced to work around a protoc issue (Plugin output is unparseable). It's crucial to determine if this issue still persists with newer versions of google-api-core when protobuf >= 4.25.8 is also installed. You might need to temporarily remove the google-api-core<2.28 constraint from noxfile.py and update constraints-3.9.txt to a more recent google-api-core version (e.g., google-api-core==2.x.x) to test this.

    • If the protoc issue is resolved with a newer google-api-core version (e.g., >=2.28) and protobuf >= 4.25.8:

      • Update noxfile.py to remove the google-api-core<2.28 constraint.
      • Update constraints-3.9.txt to pin google-api-core to a compatible, newer version (e.g., google-api-core==2.x.x) that works with protobuf==4.25.8.
    • If the protoc issue still requires google-api-core<2.28:

      • You will need to find a google-api-core version X such that 1.34.1 < X < 2.28 and X is compatible with protobuf >= 4.25.8. This might be challenging if such a version does not exist due to the protobuf v3 to v4 transition.
      • If no such version exists, you might need to explore alternative workarounds for the protoc issue or consider if the protobuf >= 4.25.8 requirement can be adjusted for the fragment session (though this goes against the PR's goal).

The most straightforward path is often to update dependencies to their latest compatible versions, assuming the underlying issues they addressed have been resolved in newer releases.

Otherwise we get a dependency conflict in the fragment tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: l Pull request size is large.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant