8000 Merge pull request #154 from lopagela/drop-old-python-version · sysfce2/python-json-logger@672e93d · GitHub
[go: up one dir, main page]

Skip to content

Commit 672e93d

Browse files
authored
Merge pull request madzak#154 from lopagela/drop-old-python-version
Drop old python version support
2 parents 2d72a31 + 97ab7f8 commit 672e93d

File tree

6 files changed

+17
-24
lines changed

6 files changed

+17
-24
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,16 @@
33
build
44
dist
55
*.egg-info
6+
7+
# Tests and validation
68
.tox/
9+
.mypy_cache
10+
11+
# Python's venv
712
.env
13+
.venv
814
env
15+
16+
# IDE
917
.vscode
18+
.idea

setup.cfg

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
[bdist_wheel]
2-
# This flag says that the code is written to work on both Python 2 and Python
3-
# 3. If at all possible, it is good practice to do this. If you cannot, you
4-
# will need to generate wheels for each Python version that you support.
5-
python-tag=py3
6-
71
[mypy]
82

93
# For details on each flag, please see the mypy documentation at:

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
package_dir={'': 'src'},
2121
packages=find_packages("src", exclude="tests"),
2222
# https://packaging.python.org/guides/distributing-packages-using-setuptools/#python-requires
23-
python_requires='>=3.5',
23+
python_requires='>=3.7',
2424
test_suite="tests.tests",
2525
classifiers=[
2626
'Development Status :: 6 - Mature',

src/pythonjsonlogger/jsonlogger.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -221,15 +221,10 @@ def format(self, record: logging.LogRecord) -> str:
221221
message_dict['exc_info'] = record.exc_text
222222
# Display formatted record of stack frames
223223
# default format is a string returned from :func:`traceback.print_stack`
224-
try:
225-
if record.stack_info and not message_dict.get('stack_info'):
226-
message_dict['stack_info'] = self.formatStack(record.stack_info)
227-
except AttributeError:
228-
# Python2.7 doesn't have stack_info.
229-
pass
230-
231-
log_record: Dict[str, Any]
232-
log_record = OrderedDict()
224+
if record.stack_info and not message_dict.get('stack_info'):
225+
message_dict['stack_info'] = self.formatStack(record.stack_info)
226+
227+
log_record: Dict[str, Any] = OrderedDict()
233228
self.add_fields(log_record, record, message_dict)
234229
log_record = self.process_log_record(log_record)
235230

tests/tests.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,7 @@
1212
except ImportError:
1313
pass
1414

15-
try:
16-
from StringIO import StringIO # noqa
17-
except ImportError:
18-
# Python 3 Support
19-
from io import StringIO
15+
from io import StringIO
2016

2117
sys.path.append('src/python-json-logger')
2218
from pythonjsonlogger import jsonlogger
@@ -78,7 +74,6 @@ def testAddStaticFields(self):
7874
self.assertEqual(logJson["log_stream"], "kafka")
7975
self.assertEqual(logJson["message"], msg)
8076

81-
8277
def testFormatKeys(self):
8378
supported_keys = [
8479
'asctime',
@@ -258,6 +253,7 @@ def encode_complex(z):
258253
msg = self.buffer.getvalue()
259254
self.assertEqual(msg, "{\"message\": \" message\", \"special\": [3.0, 8.0]}\n")
260255

256+
261257
if __name__ == '__main__':
262258
if len(sys.argv[1:]) > 0:
263259
if sys.argv[1] == 'xml':

tox.ini

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
[tox]
2-
envlist = pypy38, py36, py37, py38, py39, py310
2+
envlist = pypy38, py37, py38, py39, py310
33

44
[gh-actions]
55
python =
66
pypy-3.8: pypy38
7-
3.6: py36
87
3.7: py37
98
3.8: py38
109
3.9: py39

0 commit comments

Comments
 (0)
0