GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — feat(core): add runtime Python version support warning for EoL versions by lahirumaramba · Pull Request #997 · firebase/firebase-admin-python Conversation
|
| warnings.warn(message, FutureWarning) | ||
| return PythonVersionStatus.PYTHON_VERSION_UNSUPPORTED | ||
|
|
||
| eol_date = version_info.python_eol + EOL_GRACE_PERIOD |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
eol_date is currently calculated as version_info.python_eol + EOL_GRACE_PERIOD. Since gapic_end also defaults to version_info.python_eol + EOL_GRACE_PERIOD, this means eol_date and gapic_end are identical by default. As a result, the PYTHON_VERSION_EOL warning is only active for exactly one day. For any day between python_eol and gapic_end - 1 day (the grace period), the code falls back to returning PYTHON_VERSION_DEPRECATED. This causes the deprecation warning to be shown after the Python version has already reached its EOL, resulting in a confusing message that says "once it reaches its end of life ({version_info.python_eol})" even though that date is in the past. Changing eol_date to version_info.python_eol ensures that the EOL warning is correctly shown starting from the actual EOL date up to gapic_end.
| eol_date = version_info.python_eol + EOL_GRACE_PERIOD | |
| eol_date = version_info.python_eol |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
|
|
||
| # Perform Python version check and emit a support warning if needed. | ||
| _python_version_support.check_python_version(package='firebase-admin') |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The package name passed to check_python_version is 'firebase-admin'. However, the automatic package distribution mapping in _get_distribution_and_import_packages expects the importable module name (which is 'firebase_admin') to resolve it to the PyPI distribution name. By passing 'firebase-admin' directly, the mapping logic is bypassed because 'firebase-admin' is not a key in packages_distributions(). Passing 'firebase_admin' instead will allow the mapping to succeed and produce a more informative warning message like package firebase-admin (firebase_admin).
| _python_version_support.check_python_version(package='firebase-admin') | |
| _python_version_support.check_python_version(package='firebase_admin') |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| test_cases = { | ||
| 'supported_before_deprecation_date': { | ||
| 'date': gapic_dep - datetime.timedelta(days=1), | ||
| 'expected': PythonVersionStatus.PYTHON_VERSION_SUPPORTED, | ||
| }, | ||
| 'deprecated_on_deprecation_date': { | ||
| 'date': gapic_dep, | ||
| 'expected': PythonVersionStatus.PYTHON_VERSION_DEPRECATED, | ||
| }, | ||
| 'deprecated_on_eol_date': { | ||
| 'date': version_info.python_eol, | ||
| 'expected': PythonVersionStatus.PYTHON_VERSION_DEPRECATED, | ||
| }, | ||
| 'deprecated_before_eol_warning_starts': { | ||
| 'date': eol_warning_starts - datetime.timedelta(days=1), | ||
| 'expected': PythonVersionStatus.PYTHON_VERSION_DEPRECATED, | ||
| }, | ||
| 'eol_on_eol_warning_date': { | ||
| 'date': eol_warning_starts, | ||
| 'expected': PythonVersionStatus.PYTHON_VERSION_EOL, | ||
| }, | ||
| 'eol_on_gapic_end_date': { | ||
| 'date': gapic_end, | ||
| 'expected': PythonVersionStatus.PYTHON_VERSION_EOL, | ||
| }, | ||
| 'unsupported_after_gapic_end_date': { | ||
| 'date': gapic_end + datetime.timedelta(days=1), | ||
| 'expected': PythonVersionStatus.PYTHON_VERSION_UNSUPPORTED, | ||
| }, | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Since we are changing eol_date to version_info.python_eol, the test cases in get_tracked_version_test_cases need to be updated to reflect that the EOL warning starts on the actual EOL date rather than after the grace period.
test_cases = { 'supported_before_deprecation_date': { 'date': gapic_dep - datetime.timedelta(days=1), 'expected': PythonVersionStatus.PYTHON_VERSION_SUPPORTED, }, 'deprecated_on_deprecation_date': { 'date': gapic_dep, 'expected': PythonVersionStatus.PYTHON_VERSION_DEPRECATED, }, 'deprecated_before_eol_date': { 'date': version_info.python_eol - datetime.timedelta(days=1), 'expected': PythonVersionStatus.PYTHON_VERSION_DEPRECATED, }, 'eol_on_eol_date': { 'date': version_info.python_eol, 'expected': PythonVersionStatus.PYTHON_VERSION_EOL, }, 'eol_on_gapic_end_date': { 'date': gapic_end, 'expected': PythonVersionStatus.PYTHON_VERSION_EOL, }, 'unsupported_after_gapic_end_date': { 'date': gapic_end + datetime.timedelta(days=1), 'expected': PythonVersionStatus.PYTHON_VERSION_UNSUPPORTED, }, }
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Superseded by #998 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.