Skip to content

Conversation

@akx
Copy link
Contributor

@akx akx commented Jan 13, 2026

The indentation and leading/trailing newlines made it a little harder than necessary to filterwarnings the deprecation warning.

(For instance, for pytest's filterwarnings, you'd need "ignore:\\s+You are using a Python version 3.8:FutureWarning",...)

@akx akx requested review from a team as code owners January 13, 2026 12:33
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @akx, 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 refines the formatting of a Python end-of-life deprecation warning message. By removing leading indentation and applying the .strip() method to the multiline string, the change ensures a consistent and predictable warning message. This modification directly addresses the difficulty in programmatically filtering the warning due to its previous irregular whitespace, thereby improving developer experience when handling these warnings.

Highlights

  • Deprecation Warning Formatting: Removed leading indentation from the eol_message multiline string definition in google/auth/__init__.py.
  • Deprecation Warning Formatting: Removed leading indentation from the eol_message multiline string definition in google/oauth2/__init__.py.
  • Whitespace Handling: Added .strip() to the eol_message string definition in both files to ensure no leading or trailing whitespace, making the warning message more consistent.
  • Improved Filterability: The changes aim to simplify the programmatic filtering of the deprecation warning message by standardizing its format.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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.

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 removes indentation and leading/trailing whitespace from a deprecation warning message to make it easier to filter. The change is applied to two files where the message is duplicated. While the change is effective, I've suggested an alternative way to define the string using string literal concatenation. This improves readability by allowing indentation in the source code and results in a single-line message, which is often even easier to filter and handle in logs. Additionally, this warning message and the logic to display it are duplicated in google/auth/__init__.py and google/oauth2/__init__.py. To improve maintainability, consider refactoring this into a shared utility in a future change.

@akx
Copy link
Contributor Author

akx commented Jan 13, 2026

Good point from Gemini – changed to an implicitly concatenated string.

@chalmerlowe
Copy link
Contributor

@akx

Is this in response to something that is explicitly broken? If not, I recommend we close this OR create an Issue and deal with it later. Why?

We have a chicken or the egg issue due to the fact that so many of our repos import from our other repos as dependencies. And in every case where repo A issues some form of warning, each of our other repos B, C, D, E, ... must filter out the warning and vice versa. So anytime we change a warning, we have to update all the filterwarnings OR if we change the filterwarnings we have to then change the warning text across multiple libraries.

We had this exact thing happen several days again with one of our other repos balking because of a mod to a warning string. These minor breakages encroach on our time to add features, etc.

We have been considering this issue and I think we need a global solution with standardized warning messages and robust regex filters across all our repositories. I don't think that should start here, especially since:

  • so many libraries import this one and will then potentially need their all there filterwarnings updated
  • we are trying diligently to close out all the PRs in this repo so that we can migrate it to the google-cloud-python mono-repo (due to limitations, Issues can be ported over, but PRs can not so we need to get them all closed).

@akx
Copy link
Contributor Author

akx commented Jan 13, 2026

Is this in response to something that is explicitly broken? If not, I recommend we close this OR create an Issue and deal with it later. Why?

Yep, it's broken in that you need to jump through hoops (figuring out a "\s+" syntax) to filter out the warning, if like us at @valohai, your Pytest is configured to treat all warnings as errors by default. I bumped into this during an otherwise routine dependency upgrade.

Applying this patch makes it possible to use a simpler syntax for filterwarnings, plus the warning doesn't look weirdly indented in the terminal (and elsewhere) c.f. other warnings.

so many libraries import this one and will then potentially need their all there filterwarnings updated

This warning only began existing last week in 25f4ca6, shipped in v2.47.0. (A differently spelled warning has existed for a longer time in googleapis/python-api-core#832, but even that has only been shipped in 3 versions of that package (2.28.0, 2.28.1, 2.29.0)).

@chalmerlowe
Copy link
Contributor

@akx

Thanks for this feedback.

This provides valuable context that I did not have.

I'm re-reviewing your suggested fix now. I need to validate it against our other managed repos to ensure there aren't any regressions, but I'll update you here as soon as I have a clear path forward. Thanks for the patience!"

Copy link
Collaborator

@daniel-sanche daniel-sanche left a comment

Choose a reason for hiding this comment

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

Thanks!

Edit: Sorry Chalmer, didn't see you were looking at this. I'll leave my approval though, since it needs multi-approvers anyway

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants