Repository navigation
feat(core): warn when importing on Python 3.9 or 3.10. - #998
Open
lahirumaramba wants to merge 5 commits into
Open
lahirumaramba wants to merge 5 commits into
lahirumaramba wants to merge 5 commits into
Conversation
Add _python_version_support module (adapted from google-api-core) and invoke check_python_version(package='firebase-admin') at package import time to emit a FutureWarning on deprecated and End-of-Life Python versions (<= 3.10).
Remove dynamic package metadata lookup and unused GAPIC fields from VersionInfo, and start the EoL warning window on python_eol.
There was a problem hiding this comment.
Code Review
This pull request introduces a Python version support checking mechanism for the Firebase Admin Python SDK. It adds a new module _python_version_support.py that checks the running Python version against a list of tracked versions and issues deprecation, end-of-life, or unsupported warnings accordingly. The README.md is updated to reflect that Python 3.9 and 3.10 support is deprecated, and comprehensive tests are added in tests/test_python_version_support.py. The review feedback suggests improving the warning attribution by adding stacklevel=2 to the warnings.warn calls, and refactoring the min_python helper function to avoid grammatically awkward fallback messages.
Add stacklevel=2 to FutureWarning calls in check_python_version and include the 'Python' prefix in min_python() so the fallback wording reads naturally.
Emit a deterministic FutureWarning when sys.version_info < (3, 11) so shipped SDK releases never change runtime warning behavior on calendar dates or claim supported Python versions are unsupported.
Drop 'has reached its end of life' from the FutureWarning text so bumping _MIN_NON_DEPRECATED_VERSION works for both pre-EoL and post-EoL deprecations.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Importing
firebase_adminon Python 3.9 or 3.10 now emits aFutureWarningrecommending Python 3.11 or higher. We check against a fixed version tuple per SDK release rather than comparing the current date against an EOL calendar at runtime, so an already-released SDK version never starts printing new warnings on a future calendar date.Technical Details
firebase_admin/__init__.py) callscheck_python_version()(firebase_admin/_python_version_support.py) once at import time and comparessys.version_infoagainst_MIN_NON_DEPRECATED_VERSION = (3, 11).FutureWarning(stacklevel=2) rather thanDeprecationWarningbecause Python hidesDeprecationWarningoutside__main__by default, so application logs would otherwise miss it.python_requires='>=3.9'in this release so 3.9 and 3.10 continue to work, drop 3.9 and 3.10 in the next minor release, and bump_MIN_NON_DEPRECATED_VERSIONin future minor releases ahead of dropping older Python versions.