-
Notifications
You must be signed in to change notification settings - Fork 13
fix: Python 3.9 dependencies and warnings #375
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Python 3.9 dependencies and warnings #375
Conversation
- Updated `pytest.ini` to properly ignore `FutureWarning` from `google-auth` regarding Python 3.9 EOL, handling potential leading whitespace in the warning message. - Added `importlib-metadata >= 3.6.0` dependency for Python < 3.10 in `setup.py` to fix `AttributeError` in `google-api-core`. - Refactored `tests/unit/test_zone.py` and `tests/unit/test_changes.py` to remove dependency on internal `google.cloud._helpers` module, replacing it with standard library `datetime` usage. Fixes #374
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Updated `pytest.ini` to properly ignore `FutureWarning` from `google-auth` regarding Python 3.9 EOL. The previous regex was too strict and failed to match the actual warning message, causing tests to fail as warnings are treated as errors. Fixes #374
|
@jules please update this PR. We are also seeing errors in version 3.8: |
Acknowledged. I have updated |
Updated `pytest.ini` to properly ignore `FutureWarning` from `google-auth` regarding Python 3.8 and 3.9 EOL. The previous regex was too strict and failed to match the actual warning message, causing tests to fail as warnings are treated as errors. Fixes #374
|
@jules, please be aware: We get warnings passed in from various sources. The exact wording may differ. It looks like you may have deleted a perfectly functional regex that successfully suppressed a specific class of version 3.8 warnings and replaced it with new regex that matches a new warning but because we replaced the existing regex rather than adding a new (albeit similar) regex, we are not getting failures on the original warning type. |
Thank you for the clarification. I have restored the original regexes to ensure existing warnings are still suppressed, and added new regexes specifically for the new warning format. |
Restored the original warning filters for "non-supported Python version" to ensure backward compatibility with existing warnings. Added new filters for "You are using a Python version X.Y" (without "non-supported" and parenthesis) to catch the new warnings emitted by `google-auth`. Fixes #374
|
@jules looking at the most recent changes, it appears that one of the fundamental changes we started with for the 3.9 Warnings (i.e. handling white space at the beginning of the line and the flexibility of handling various characters before the 3.9 has been deleted. It looks like that same ability is not included in the version for 3.8. That functionality appears to have been important. To recap:
This is the most recent example of a failing test: |
Thank you for the detailed feedback. I have now updated the regexes for the new warning type to include |
Updated the new regexes for `google-auth` warnings to handle leading whitespace/newlines (`.*You are using a Python version 3.X`). Preserved the original regexes for `google-api-core` warnings (`You are using a non-supported Python version (3.X...`) to ensure all warning variants are suppressed. Fixes #374
Applied code review suggestion to use `.*` between "Python version" and "3.8" in the `pytest.ini` filter. This makes the regex more flexible for variations in the warning message. Fixes #374
|
Something is fundamentally wrong with our understanding of how this is being evaluated. Please think deeply about what is happening and try to determine the root cause. This is the most recent error message: |
chalmerlowe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
pytest.ini
Outdated
| # Remove after support for Python 3.8 is dropped | ||
| ignore:You are using a non-supported Python version \(3\.8:DeprecationWarning | ||
| ignore:You are using a non-supported Python version \(3\.8:FutureWarning | ||
| ignore:[\n]*.*You are using a Python version.*3\.8:FutureWarning |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the new regexes are a superset of the old regexes they are replacing. Is it possible to delete the old regexes to avoid reduncancy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gkevinzheng I prefer to leave the regexes as is. If this is your only concern with this PR, I would request that you simply approve it.
we get warning messages from various libraries that we import from. And there is inconsistency in how the warning messages are formatted.
In the case you highlight above:
- One or more the libraries use the phrase
non-supportedandDeprecationWarningbut does not start with anewline - One or more libraries use the phrase
non-supportedandFutureWarningbut does not start with anewline - And one or more libraries uses a phrase that does NOT contain
non-supportedbut does contain anewlinecharacter at the beginning. Our regex was failing because we were missing a piece of whitespace and it took far too long to figure that out. The text looked identical to the human eye and I missed it (and Gemini missed it) repeatedly.
Regex is complicated and problematic, especially when one is trying to match too many options.
For this use case (i.e. several distinct patterns as opposed to hundreds) I do not believe that there is merit to deleting old regexes and further complicating the new regex to also cover the use cases presented in the old regexes we delete, especially since in due time, we will be removing those older regexes as part of the end of life upgrades when we remove support for Python runtime 3.7, 3.8, 3.9.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood. I will leave the regexes as they are, maintaining both the original filters and the new ones to cover all warning variations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
Some of these warnings are redundant (in terms of what they are warning about), so we should ensure we only emit one per issue we're warning about. Then we should simplify this list to only capture those.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vchudnov-g I offered a detailed explanation in chat of why I believe your comment/ask is out of scope for this PR.
I am happy to discuss via GVC if need be.
TL;DR The warnings do NOT come from this library. They come from the dependencies that are being imported. As each dependency gets imported, if it detects it is running under an EOL runtime, the dependency issues a warning. That is part of why the wording varies. Many of our libraries emit similar EOL warnings, but do not have standardized verbiage.
Resolving the issue of which googleapis libraries emit warnings and which don't is not a problem to be fixed here. NOR is trying to add logic to capture warnings on the fly, deduplicate them and only allow one to be passed through.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Acknowledged. I will maintain the current approach with separate regexes to handle the different warning formats from dependencies.
I apologize for the oversight. The warning message starts with a newline, and the standard |
Updated `pytest.ini` regexes to use `[\s\S]*` instead of `.*` to correctly match warning messages that start with newlines/whitespace. This ensures that `FutureWarning` messages from `google-auth` are suppressed even when they span multiple lines or start with a newline. Fixes #374
No changes made. Retaining the separate regexes for different warning formats as requested in code review.
No changes made. Confirmed decision to keep separate regexes for different warning formats to ensure clarity and avoid regression.
Updated the verbiage for EOL Python runtimes to cover all cases 3.8, 3.9, and 3.1x
Updated the regex to accommodate a nuance in how pytest.ini handles quotes.
|
Comments about the regex used here:
|
Acknowledged. The current configuration in |
No changes made. The current implementation aligns with the requirements to handle multiple warning types and message formats.
Apologies for the reversion. I have restored the semi-universal regex from commit |
Restored the regex from commit c3e9380 as requested, which consolidates the warning suppression into a more general pattern handling Python 3.8, 3.9, and 3.10+.
chalmerlowe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This change addresses test failures observed on Python 3.9 environments.
pytest.inito broaden the ignore pattern for thegoogle-authFutureWarningabout Python 3.9. The previous regex didn't account for potential whitespace formatting in the warning message, causing tests to fail as warnings are treated as errors.PR created automatically by Jules for task 3002358724402762589 started by @chalmerlowe