Fix DeprecationWarning in pythonjsonlogger>=3.1.0
#3120
+6
−1
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.
pythonjsonlogger.jsonlogger
is deprecated as of pythonjsonlogger>=3.1.0:https://github.com/nhairs/python-json-logger/releases/tag/v3.1.0
https://github.com/nhairs/python-json-logger/blob/db04a0f9066cc331f8d6177f828fe073c7b2a4cc/src/pythonjsonlogger/jsonlogger.py
Why are the changes needed?
This is a warning of an impending deprecation.
What changes were proposed in this pull request?
To not import a deprecated module.
How was this patch tested?
Running them in CI here. Let's find out if they pass.
Check all the applicable boxes
Summary by Bito
Updated import statement in flytekit/loggers.py to handle pythonjsonlogger>=3.1.0 deprecation warning. Implemented conditional import logic to check for new module path (pythonjsonlogger.json) with fallback to legacy path (pythonjsonlogger.jsonlogger). Change ensures backward compatibility across different versions of pythonjsonlogger package.Unit tests added: False
Estimated effort to review (1-5, lower is better): 1