Skip to content

feat(core): add runtime Python version support warning for EoL versions - #998

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

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

Conversation

@lahirumaramba

@lahirumaramba lahirumaramba commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Summary

Implements the policy to drop End-of-Life (EoL) Python versions in minor releases, aligning firebase-admin with Google Cloud Python client libraries and google-api-core.

Adds firebase_admin/_python_version_support.py (adapted from google.api_core._python_version_support) and invokes check_python_version() once at package import time in firebase_admin/__init__.py.

Key Changes

  • Runtime Python Version Support Check (firebase_admin/_python_version_support.py):
    • Matches google-api-core lifecycle defaults (deprecation_date = python_eol - 1 year, end_of_support_date = python_eol + 1 week) with no custom grace overrides.
    • Includes an explicit VersionInfo entry for Python 3.9 (PSF EoL 2025-10-05) alongside Python 3.10–3.14 so that the warning recommends upgrading to at least Python 3.11. With default end_of_support_date, both Python 3.9 and 3.10 (both past EoL) emit the PYTHON_VERSION_UNSUPPORTED FutureWarning ("You are using a non-supported Python version... upgrade to at least Python 3.11"), matching the upcoming removal of both 3.9 and 3.10 in the next minor release.
    • Emits FutureWarning (rather than DeprecationWarning, which Python hides by default outside __main__) so developers see the warning in logs when importing firebase_admin.
    • Invoked once at package import time in firebase_admin/__init__.py (_python_version_support.check_python_version()).
  • Documentation (README.md):
    • Updates the Supported Python Versions section to note that Python 3.9 and 3.10 support is deprecated and will be dropped in an upcoming minor release, and recommends Python 3.11 or higher.
  • Unit Tests (tests/test_python_version_support.py):
    • Adds 43 date-injected unit tests (today= parameter) covering Python 3.9, 3.10, supported versions (3.11–3.14), untracked older (3.8) and future (3.15, 40.0) versions, and deprecation_date / end_of_support_date overrides.

Proposed Release Note

Python 3.9 and 3.10 are deprecated (both past EOL). Importing firebase_admin on these versions now emits a FutureWarning. Support for both will be dropped in the next minor release; please upgrade to Python 3.11 or higher.

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.

Comment thread firebase_admin/_python_version_support.py
Add stacklevel=2 to FutureWarning calls in check_python_version and include the 'Python' prefix in min_python() so the fallback wording reads naturally.

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