-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix import pthonjsonlogger.jsonlogger (#33)
Fixes: #29 Although efforts were made for backwards compatibility using `__getattr__` in `pythonjsonlogger/__init__.py`, this only worked if you were doing `from pythonjsonlogger import jsonlogger`. When importing by the full name `import pythonjsonlogger.jsonlogger` it it would fail to locate the module file and thus not be able to produce a module spec which then of course causes the import to fail. We get around this by actually having a module that imports the names it needs from the new locations. ### Test Plan - Run unit tests
- Loading branch information
Showing
6 changed files
with
48 additions
and
18 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
*.swp | ||
build | ||
dist | ||
dist_uploaded | ||
*.egg-info | ||
|
||
# Tests and validation | ||
|
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" | |
|
||
[project] | ||
name = "python-json-logger" | ||
version = "3.2.0" | ||
version = "3.2.1" | ||
description = "JSON Log Formatter for the Python Logging Package" | ||
authors = [ | ||
{name = "Zakaria Zajac", email = "[email protected]"}, | ||
|
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
"""Stub module retained for compatibility. | ||
It retains access to old names whilst sending deprecation warnings. | ||
""" | ||
|
||
# pylint: disable=wrong-import-position,unused-import | ||
|
||
import warnings | ||
|
||
## Throw warning | ||
warnings.warn( | ||
"pythonjsonlogger.jsonlogger has been moved to pythonjsonlogger.json", | ||
DeprecationWarning, | ||
) | ||
|
||
## Import names | ||
from .json import JsonFormatter, JsonEncoder | ||
from .core import RESERVED_ATTRS |
This file contains 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