Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: require Python ≥ 3.9#2502

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
vchudnov-g wants to merge11 commits intomain
base:main
Choose a base branch
Loading
frompy-drop-37
Draft

chore: require Python ≥ 3.9#2502

vchudnov-g wants to merge11 commits intomainfrompy-drop-37

Conversation

@vchudnov-g
Copy link
Contributor

No description provided.

@product-auto-labelproduct-auto-labelbot added the size: xlPull request size is extra large. labelDec 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 thesetup.py for package distribution,noxfile.py for development and testing environments, andDEVELOPMENT.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: Thesetup.py file has been updated to reflect the new minimum Python requirement in its classifiers and thepython_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 ourdocumentation 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.

FeatureCommandDescription
Code Review/gemini reviewPerforms a code review for the current pull request in its current state.
Pull Request Summary/gemini summaryProvides a summary of the current pull request in its current state.
Comment@gemini-code-assistResponds in comments when explicitly tagged, both in pull request comments and review comments.
Help/gemini helpDisplays 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 foundhere.

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 uphere.

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

Footnotes

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

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

@gemini-code-assistgemini-code-assistbot 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 updatingDEVELOPMENT.md,noxfile.py, andsetup.py. The changes made are correct, but the effort is incomplete. The update tonoxfile.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 likegapic/templates/noxfile.py.j2 andgapic/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 onnoxfile.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 fromALL_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: Theif session.python == "3.7": block.
  • Line 480:"asyncmock; python_version < '3.8'"
  • Lines 486-499: Theif session.python == "3.7" and rest_async_io_enabled: block.

@product-auto-labelproduct-auto-labelbot added size: mPull request size is medium. and removed size: xlPull request size is extra large. labelsDec 8, 2025
@vchudnov-g
Copy link
ContributorAuthor

/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 innoxfile.py concerning thegoogle-api-core dependency.

In thenoxfile.py, specifically within thefragment session (andshowcase_library session), there was a conditional installation ofgoogle-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 (seenoxfile.py lines 174-176 in the new code):

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

This means that for Python 3.11 and 3.12, thegoogle-api-core<2.28 constraint is no longer enforced. If the underlying issue withprotoc andgoogle-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 ofgoogle-api-core that is being installed for Python 3.12.
  2. Any error messages related toprotoc or "Plugin output is unparseable."

If the issue persists, you might need to either:

  • Extend thegoogle-api-core<2.28 constraint to include Python 3.12 innoxfile.py if the problem is still present with newergoogle-api-core versions.
  • Investigate if there's a newer version ofgoogle-api-core orprotoc that resolves this incompatibility for Python 3.12, which might be what you have locally.

@vchudnov-g
Copy link
ContributorAuthor

/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.protonox > 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 executablePlease 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 atHEAD?

@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 aboutgoogle-api-core was incorrect given this new information.

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

Looking at the changes innoxfile.py for thefragment session (specifically DIFF 2), it appears that the linesession.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, theprotoc-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-addsession.install("-e", ".") to thefragment session innoxfile.py.

Here's a suggested change:

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

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

@product-auto-labelproduct-auto-labelbot added size: lPull request size is large. and removed size: mPull request size is medium. labelsDec 9, 2025
@vchudnov-g
Copy link
ContributorAuthor

/gemini Why isfragment-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 theprotoc-gen-python_gapic issue might be resolved. The new error indicating a "dependency conflict" forfragment-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 innoxfile.py for Python versions 3.9 and 3.10 within thefragment session (andshowcase_library session). This was originally put in place to avoid a "Plugin output is unparseable" error withprotoc when usinggoogle-api-core versions>=2.28.
  2. protobuf >= 4.25.8: This is the new minimumprotobuf version required by the project, as updated insetup.py andrequirements.in.

While the direct dependency ranges ofgoogle-api-core (e.g.,2.27.0 requiresprotobuf >= 3.19.5, < 5.0.0) and the project'sprotobuf 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 oldergoogle-api-core versions and the newerprotobuf version (4.25.8). It's possible that a sub-dependency ofgoogle-api-core<2.28 has a stricter upper bound onprotobuf that is violated by4.25.8.

To pinpoint the exact conflict, I recommend examining the detailed logs from thefragment-3.9 Nox session. Look for messages frompip 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 frompip, we can better assess the best path forward, which might involve:

  • Investigating if newer versions ofgoogle-api-core (i.e.,>=2.28) are now compatible withprotobuf >= 4.25.8 and no longer cause theprotoc issue (perhaps due to updates inprotoc orgrpcio-tools).
  • Adjusting theprotobuf requirement for thefragment session if a compatible range can be found that satisfies bothgoogle-api-core<2.28 and the project's needs.

@vchudnov-g
Copy link
ContributorAuthor

/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/libnox > Running session fragment-3.9nox > Creating virtual environment (virtualenv) using python3.9 in .nox/fragment-3-9nox > python -m pip install coverage pytest pytest-cov pytest-xdist pytest-asyncio grpcio-toolsnox > 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.protonox > python -m pip install /tmp/tmp0vr9__1f -e . -qqq -r /tmp/tmp0vr9__1f/testing/constraints-3.9.txtnox > 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-conflictsnox > 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 forfragment-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 betweengoogle-api-core==1.34.1 (which is on line 8 ofconstraints-3.9.txt) andprotobuf==4.25.8 (which is also explicitly set inconstraints-3.9.txt and required by the main project and generated client).

Whilegoogle-api-core 1.34.1's direct dependency onprotobuf (>=3.19.5, <5.0.0) appears compatible withprotobuf 4.25.8, thisResolutionImpossible error usually means that atransitive dependency ofgoogle-api-core==1.34.1 has a stricter upper bound onprotobuf that conflicts with4.25.8.

To resolve this, I recommend the following steps:

  1. Identify the exact transitive conflict:

    • In a local environment (or by examining thepip logs more closely), try to installgoogle-api-core==1.34.1 andprotobuf==4.25.8 together. Use tools likepipdeptree orpip check to inspect the full dependency graph and pinpoint which specific sub-dependency ofgoogle-api-core==1.34.1 is imposing an incompatibleprotobuf version.
  2. Re-evaluate thegoogle-api-core<2.28 constraint:

    • Thegoogle-api-core<2.28 constraint innoxfile.py was introduced to work around aprotoc issue (Plugin output is unparseable). It's crucial to determine if this issue still persists with newer versions ofgoogle-api-core whenprotobuf >= 4.25.8 is also installed. You might need to temporarily remove thegoogle-api-core<2.28 constraint fromnoxfile.py and updateconstraints-3.9.txt to a more recentgoogle-api-core version (e.g.,google-api-core==2.x.x) to test this.

    • If theprotoc issue is resolved with a newergoogle-api-core version (e.g.,>=2.28) andprotobuf >= 4.25.8:

      • Updatenoxfile.py to remove thegoogle-api-core<2.28 constraint.
      • Updateconstraints-3.9.txt to pingoogle-api-core to a compatible, newer version (e.g.,google-api-core==2.x.x) that works withprotobuf==4.25.8.
    • If theprotoc issuestill requiresgoogle-api-core<2.28:

      • You will need to find agoogle-api-core versionX such that1.34.1 < X < 2.28 andX is compatible withprotobuf >= 4.25.8. This might be challenging if such a version does not exist due to theprotobuf v3 to v4 transition.
      • If no such version exists, you might need to explore alternative workarounds for theprotoc issue or consider if theprotobuf >= 4.25.8 requirement can be adjusted for thefragment 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 freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

1 more reviewer

@gemini-code-assistgemini-code-assist[bot]gemini-code-assist[bot] left review comments

Reviewers whose approvals may not affect merge requirements

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

size: lPull request size is large.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

@vchudnov-g

[8]ページ先頭

©2009-2025 Movatter.jp