Skip to content

feat(core): warn when importing on Python 3.9 or 3.10. - #998

Open
lahirumaramba wants to merge 5 commits into
mainfrom
lm-python-version-support-warning
Open

lahirumaramba wants to merge 5 commits into
mainfrom
lm-python-version-support-warning

Conversation

@lahirumaramba

@lahirumaramba lahirumaramba commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Importing firebase_admin on Python 3.9 or 3.10 now emits a FutureWarning recommending 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
  • Package initialization (firebase_admin/__init__.py) calls check_python_version() (firebase_admin/_python_version_support.py) once at import time and compares sys.version_info against _MIN_NON_DEPRECATED_VERSION = (3, 11).
  • Emits FutureWarning (stacklevel=2) rather than DeprecationWarning because Python hides DeprecationWarning outside __main__ by default, so application logs would otherwise miss it.
  • Rollout: keep 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_VERSION in future minor releases ahead of dropping older Python versions.

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.

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

Copy link
Copy Markdown

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 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.
@lahirumaramba lahirumaramba changed the title feat(core): add runtime Python version support warning for EoL versions feat(core): warn when importing on Python 3.9 or 3.10. Nov 3, 2026

This branch has not been deployed

No deployments
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.

1 participant