python-json-logger 4.3.0.dev3__tar.gz → 4.3.0rc1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_json_logger-4.3.0.dev3/src/python_json_logger.egg-info → python_json_logger-4.3.0rc1}/PKG-INFO +2 -2
- {python_json_logger-4.3.0.dev3 → python_json_logger-4.3.0rc1}/README.md +1 -1
- {python_json_logger-4.3.0.dev3 → python_json_logger-4.3.0rc1}/pyproject.toml +6 -1
- {python_json_logger-4.3.0.dev3 → python_json_logger-4.3.0rc1/src/python_json_logger.egg-info}/PKG-INFO +2 -2
- {python_json_logger-4.3.0.dev3 → python_json_logger-4.3.0rc1}/src/python_json_logger.egg-info/SOURCES.txt +1 -2
- {python_json_logger-4.3.0.dev3 → python_json_logger-4.3.0rc1}/src/pythonjsonlogger/core.py +11 -3
- python_json_logger-4.3.0.dev3/tests/test_release.py +0 -212
- {python_json_logger-4.3.0.dev3 → python_json_logger-4.3.0rc1}/LICENSE +0 -0
- {python_json_logger-4.3.0.dev3 → python_json_logger-4.3.0rc1}/MANIFEST.in +0 -0
- {python_json_logger-4.3.0.dev3 → python_json_logger-4.3.0rc1}/scripts/benchmark_plots.py +0 -0
- {python_json_logger-4.3.0.dev3 → python_json_logger-4.3.0rc1}/scripts/benchmark_report.py +0 -0
- {python_json_logger-4.3.0.dev3 → python_json_logger-4.3.0rc1}/setup.cfg +0 -0
- {python_json_logger-4.3.0.dev3 → python_json_logger-4.3.0rc1}/src/python_json_logger.egg-info/dependency_links.txt +0 -0
- {python_json_logger-4.3.0.dev3 → python_json_logger-4.3.0rc1}/src/python_json_logger.egg-info/top_level.txt +0 -0
- {python_json_logger-4.3.0.dev3 → python_json_logger-4.3.0rc1}/src/pythonjsonlogger/__init__.py +0 -0
- {python_json_logger-4.3.0.dev3 → python_json_logger-4.3.0rc1}/src/pythonjsonlogger/defaults.py +0 -0
- {python_json_logger-4.3.0.dev3 → python_json_logger-4.3.0rc1}/src/pythonjsonlogger/exception.py +0 -0
- {python_json_logger-4.3.0.dev3 → python_json_logger-4.3.0rc1}/src/pythonjsonlogger/json.py +0 -0
- {python_json_logger-4.3.0.dev3 → python_json_logger-4.3.0rc1}/src/pythonjsonlogger/jsonlogger.py +0 -0
- {python_json_logger-4.3.0.dev3 → python_json_logger-4.3.0rc1}/src/pythonjsonlogger/msgspec.py +0 -0
- {python_json_logger-4.3.0.dev3 → python_json_logger-4.3.0rc1}/src/pythonjsonlogger/orjson.py +0 -0
- {python_json_logger-4.3.0.dev3 → python_json_logger-4.3.0rc1}/src/pythonjsonlogger/py.typed +0 -0
- {python_json_logger-4.3.0.dev3 → python_json_logger-4.3.0rc1}/src/pythonjsonlogger/utils.py +0 -0
- {python_json_logger-4.3.0.dev3 → python_json_logger-4.3.0rc1}/tests/__init__.py +0 -0
- {python_json_logger-4.3.0.dev3 → python_json_logger-4.3.0rc1}/tests/test_benchmark_report.py +0 -0
- {python_json_logger-4.3.0.dev3 → python_json_logger-4.3.0rc1}/tests/test_cookbook.py +0 -0
- {python_json_logger-4.3.0.dev3 → python_json_logger-4.3.0rc1}/tests/test_deprecation.py +0 -0
- {python_json_logger-4.3.0.dev3 → python_json_logger-4.3.0rc1}/tests/test_dictconfig.py +0 -0
- {python_json_logger-4.3.0.dev3 → python_json_logger-4.3.0rc1}/tests/test_formatters.py +0 -0
- {python_json_logger-4.3.0.dev3 → python_json_logger-4.3.0rc1}/tests/test_missing.py +0 -0
- {python_json_logger-4.3.0.dev3 → python_json_logger-4.3.0rc1}/tests/test_publish_docs.py +0 -0
- {python_json_logger-4.3.0.dev3 → python_json_logger-4.3.0rc1}/tests/test_quickstart.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-json-logger
|
|
3
|
-
Version: 4.3.
|
|
3
|
+
Version: 4.3.0rc1
|
|
4
4
|
Summary: JSON Log Formatter for the Python Logging Package
|
|
5
5
|
Author-email: Zakaria Zajac <zak@madzak.com>, Nicholas Hairs <info+python-json-logger@nicholashairs.com>
|
|
6
6
|
Maintainer-email: Nicholas Hairs <info+python-json-logger@nicholashairs.com>
|
|
@@ -29,7 +29,7 @@ Dynamic: license-file
|
|
|
29
29
|
[](https://pypi.python.org/pypi/python-json-logger/)
|
|
30
30
|
[](https://github.com/nhairs/python-json-logger)
|
|
31
31
|
[](https://github.com/nhairs/python-json-logger)
|
|
32
|
-

|
|
33
33
|
#
|
|
34
34
|
# Python JSON Logger
|
|
35
35
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](https://pypi.python.org/pypi/python-json-logger/)
|
|
4
4
|
[](https://github.com/nhairs/python-json-logger)
|
|
5
5
|
[](https://github.com/nhairs/python-json-logger)
|
|
6
|
-

|
|
7
7
|
#
|
|
8
8
|
# Python JSON Logger
|
|
9
9
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "python-json-logger"
|
|
7
|
-
version = "4.3.
|
|
7
|
+
version = "4.3.0rc1"
|
|
8
8
|
description = "JSON Log Formatter for the Python Logging Package"
|
|
9
9
|
authors = [
|
|
10
10
|
{name = "Zakaria Zajac", email = "zak@madzak.com"},
|
|
@@ -83,6 +83,11 @@ include = ["pythonjsonlogger*"]
|
|
|
83
83
|
[tool.setuptools.package-data]
|
|
84
84
|
pythonjsonlogger = ["py.typed"]
|
|
85
85
|
|
|
86
|
+
[tool.nopt]
|
|
87
|
+
allow-dirty = []
|
|
88
|
+
dev-release-branches = ["main"]
|
|
89
|
+
github-release-types = ["dev", "pre", "final"]
|
|
90
|
+
|
|
86
91
|
[tool.black]
|
|
87
92
|
line-length = 100
|
|
88
93
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-json-logger
|
|
3
|
-
Version: 4.3.
|
|
3
|
+
Version: 4.3.0rc1
|
|
4
4
|
Summary: JSON Log Formatter for the Python Logging Package
|
|
5
5
|
Author-email: Zakaria Zajac <zak@madzak.com>, Nicholas Hairs <info+python-json-logger@nicholashairs.com>
|
|
6
6
|
Maintainer-email: Nicholas Hairs <info+python-json-logger@nicholashairs.com>
|
|
@@ -29,7 +29,7 @@ Dynamic: license-file
|
|
|
29
29
|
[](https://pypi.python.org/pypi/python-json-logger/)
|
|
30
30
|
[](https://github.com/nhairs/python-json-logger)
|
|
31
31
|
[](https://github.com/nhairs/python-json-logger)
|
|
32
|
-

|
|
33
33
|
#
|
|
34
34
|
# Python JSON Logger
|
|
35
35
|
|
|
@@ -98,10 +98,18 @@ def merge_record_extra(
|
|
|
98
98
|
"""
|
|
99
99
|
if rename_fields is None:
|
|
100
100
|
rename_fields = {}
|
|
101
|
-
|
|
101
|
+
record_dict = record.__dict__
|
|
102
|
+
for key in record_dict:
|
|
103
|
+
if key in reserved:
|
|
104
|
+
continue
|
|
102
105
|
# this allows to have numeric keys
|
|
103
|
-
|
|
104
|
-
|
|
106
|
+
# an exact str check is faster than hasattr() for the common case
|
|
107
|
+
if type(key) is str: # pylint: disable=unidiomatic-typecheck
|
|
108
|
+
if key.startswith("_"):
|
|
109
|
+
continue
|
|
110
|
+
elif hasattr(key, "startswith") and key.startswith("_"):
|
|
111
|
+
continue
|
|
112
|
+
target[rename_fields.get(key, key)] = record_dict[key]
|
|
105
113
|
return target
|
|
106
114
|
|
|
107
115
|
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
"""Unit tests for release policy; no external build, Git, or API integration tests."""
|
|
2
|
-
|
|
3
|
-
import hashlib
|
|
4
|
-
import importlib.util
|
|
5
|
-
import json
|
|
6
|
-
from pathlib import Path
|
|
7
|
-
|
|
8
|
-
import pytest
|
|
9
|
-
|
|
10
|
-
pytest.importorskip("tomllib")
|
|
11
|
-
ROOT = Path(__file__).parents[1]
|
|
12
|
-
SPEC = importlib.util.spec_from_file_location("release", ROOT / "scripts/release.py")
|
|
13
|
-
assert SPEC is not None and SPEC.loader is not None
|
|
14
|
-
release = importlib.util.module_from_spec(SPEC)
|
|
15
|
-
SPEC.loader.exec_module(release)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def changelog(stamp: str = "2026-10-28", body: str = "### Added\n- A feature.") -> str:
|
|
19
|
-
return f"# Changes\n\n## [4.3.0](compare) - {stamp}\n\n{body}\n\n## [4.2.0](old) - 2026-08-15\nOld\n"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
@pytest.mark.parametrize(
|
|
23
|
-
"tag,version",
|
|
24
|
-
[
|
|
25
|
-
("v4.3.0", "4.3.0"),
|
|
26
|
-
("v4.3.0.rc1", "4.3.0rc1"),
|
|
27
|
-
("v4.3.0.dev1", "4.3.0.dev1"),
|
|
28
|
-
("v4.3.0.post1", "4.3.0.post1"),
|
|
29
|
-
],
|
|
30
|
-
)
|
|
31
|
-
def test_release_info(tag: str, version: str) -> None:
|
|
32
|
-
actual, notes = release.release_info(tag, version, changelog())
|
|
33
|
-
assert actual == version
|
|
34
|
-
assert notes == changelog().split("\n\n", 1)[1].split("## [4.2.0]", 1)[0].rstrip() + "\n"
|
|
35
|
-
return None
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
@pytest.mark.parametrize(
|
|
39
|
-
"tag",
|
|
40
|
-
[
|
|
41
|
-
"4.3.0",
|
|
42
|
-
"v4.3",
|
|
43
|
-
"v04.3.0",
|
|
44
|
-
"v4.3.0rc1",
|
|
45
|
-
"v4.3.0.rc01",
|
|
46
|
-
"v4.3.0\n",
|
|
47
|
-
"vladamir/test-the-new-thing",
|
|
48
|
-
"v4.3.0a1",
|
|
49
|
-
"v4.3.0.rc1.extra",
|
|
50
|
-
],
|
|
51
|
-
)
|
|
52
|
-
def test_invalid_tags(tag: str) -> None:
|
|
53
|
-
with pytest.raises(ValueError):
|
|
54
|
-
release.release_info(tag, "4.3.0", changelog())
|
|
55
|
-
return None
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
@pytest.mark.parametrize(
|
|
59
|
-
"text",
|
|
60
|
-
[
|
|
61
|
-
changelog(body="### Added\n"),
|
|
62
|
-
changelog() + changelog(),
|
|
63
|
-
changelog().replace("[4.3.0]", "[4.4.0]"),
|
|
64
|
-
changelog(stamp="UNRELEASED"),
|
|
65
|
-
changelog(stamp="2026-02-30"),
|
|
66
|
-
],
|
|
67
|
-
)
|
|
68
|
-
def test_invalid_changelog(text: str) -> None:
|
|
69
|
-
with pytest.raises(ValueError):
|
|
70
|
-
release.release_info("v4.3.0", "4.3.0", text)
|
|
71
|
-
return None
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
@pytest.mark.parametrize(
|
|
75
|
-
"tag,version",
|
|
76
|
-
[("v4.3.0", "4.3.0"), ("v4.3.0.rc1", "4.3.0rc1"), ("v4.3.0.post1", "4.3.0.post1")],
|
|
77
|
-
)
|
|
78
|
-
def test_non_development_requires_date(tag: str, version: str) -> None:
|
|
79
|
-
with pytest.raises(ValueError, match="requires a changelog date"):
|
|
80
|
-
release.release_info(tag, version, changelog("UNRELEASED"))
|
|
81
|
-
return None
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
def test_development_unreleased_and_version_mismatch() -> None:
|
|
85
|
-
assert (
|
|
86
|
-
release.release_info("v4.3.0.dev1", "4.3.0.dev1", changelog("UNRELEASED"))[0]
|
|
87
|
-
== "4.3.0.dev1"
|
|
88
|
-
)
|
|
89
|
-
with pytest.raises(ValueError):
|
|
90
|
-
release.release_info("v4.3.0", "4.3.0.dev1", changelog())
|
|
91
|
-
return None
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
def test_postrelease_preserves_original_date() -> None:
|
|
95
|
-
text = changelog("2025-01-02")
|
|
96
|
-
_, notes = release.release_info("v4.3.0.post1", "4.3.0.post1", text)
|
|
97
|
-
assert notes.startswith("## [4.3.0](compare) - 2025-01-02\n")
|
|
98
|
-
return None
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
@pytest.mark.parametrize("existing", [{}, {"wheel": "aaa"}, {"wheel": "aaa", "sdist": "bbb"}])
|
|
102
|
-
def test_any_pypi_record_blocks_new_release(existing: dict[str, str]) -> None:
|
|
103
|
-
with pytest.raises(ValueError, match="already exists"):
|
|
104
|
-
release.require_unpublished(existing)
|
|
105
|
-
return None
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
def test_absent_version_is_eligible() -> None:
|
|
109
|
-
release.require_unpublished(None)
|
|
110
|
-
return None
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
@pytest.mark.parametrize(
|
|
114
|
-
"existing", [None, {}, {"wheel": "aaa"}, {"wheel": "wrong", "sdist": "bbb"}]
|
|
115
|
-
)
|
|
116
|
-
def test_finalize_requires_complete_matching_publication(existing: dict[str, str] | None) -> None:
|
|
117
|
-
with pytest.raises(ValueError, match="complete release manifest"):
|
|
118
|
-
release.require_published({"wheel": "aaa", "sdist": "bbb"}, existing)
|
|
119
|
-
return None
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
def test_complete_publication_can_finalize() -> None:
|
|
123
|
-
release.require_published({"wheel": "aaa", "sdist": "bbb"}, {"wheel": "aaa", "sdist": "bbb"})
|
|
124
|
-
return None
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
@pytest.mark.parametrize("commit,expected", [("abc", "update"), ("def", "replace")])
|
|
128
|
-
def test_draft_commit_policy(commit: str, expected: str) -> None:
|
|
129
|
-
assert release.draft_action({"draft": True, "target_commitish": commit}, "abc") == expected
|
|
130
|
-
return None
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
def test_public_release_requires_owner_cleanup() -> None:
|
|
134
|
-
assert release.draft_action(None, "abc") == "create"
|
|
135
|
-
with pytest.raises(ValueError, match="owner cleanup"):
|
|
136
|
-
release.draft_action({"draft": False, "target_commitish": "abc"}, "abc")
|
|
137
|
-
return None
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
@pytest.mark.parametrize("kind,current", [("commit", "old"), ("tree", "approved")])
|
|
141
|
-
def test_stale_run_cannot_publish(kind: str, current: str) -> None:
|
|
142
|
-
with pytest.raises(ValueError, match="stale run"):
|
|
143
|
-
release.require_current_commit(kind, current, "approved")
|
|
144
|
-
return None
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
def test_live_source_matches_approval() -> None:
|
|
148
|
-
release.require_current_commit("commit", "approved", "approved")
|
|
149
|
-
return None
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
def test_bundle_identity_and_checksums(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
|
153
|
-
directory = tmp_path / "dist"
|
|
154
|
-
directory.mkdir()
|
|
155
|
-
# Treat distributions as opaque bytes: this checks our retained-file policy.
|
|
156
|
-
files = {"package.whl": b"wheel bytes", "package.tar.gz": b"sdist bytes"}
|
|
157
|
-
for name, content in files.items():
|
|
158
|
-
(directory / name).write_bytes(content)
|
|
159
|
-
(tmp_path / "SHA256SUMS.json").write_text(
|
|
160
|
-
json.dumps({name: hashlib.sha256(content).hexdigest() for name, content in files.items()})
|
|
161
|
-
)
|
|
162
|
-
(tmp_path / "release.json").write_text(
|
|
163
|
-
json.dumps({"tag": "v4.3.0", "commit": "abc", "run_id": "123"})
|
|
164
|
-
)
|
|
165
|
-
monkeypatch.setenv("GITHUB_RUN_ID", "123")
|
|
166
|
-
monkeypatch.setenv("GITHUB_REF_NAME", "v4.3.0")
|
|
167
|
-
monkeypatch.setenv("GITHUB_SHA", "wrong")
|
|
168
|
-
with pytest.raises(ValueError, match="commit mismatch"):
|
|
169
|
-
release.verify_bundle(tmp_path)
|
|
170
|
-
monkeypatch.setenv("GITHUB_SHA", "abc")
|
|
171
|
-
assert set(release.verify_bundle(tmp_path)) == {"package.whl", "package.tar.gz"}
|
|
172
|
-
monkeypatch.setenv("GITHUB_RUN_ID", "another-run")
|
|
173
|
-
with pytest.raises(ValueError, match="different workflow run"):
|
|
174
|
-
release.verify_bundle(tmp_path)
|
|
175
|
-
monkeypatch.setenv("GITHUB_RUN_ID", "123")
|
|
176
|
-
(directory / "package.whl").write_bytes(b"corrupted")
|
|
177
|
-
with pytest.raises(ValueError, match="checksum mismatch"):
|
|
178
|
-
release.verify_bundle(tmp_path)
|
|
179
|
-
return None
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
@pytest.mark.parametrize("date", ["2025-01-02", "2026-01-02"])
|
|
183
|
-
def test_postrelease_date_policy(date: str) -> None:
|
|
184
|
-
original = "## [4.2.0](compare) - 2025-01-02\n\n- Original changes.\n"
|
|
185
|
-
post = f"## [4.2.0](compare) - {date}\n\n- Extra post-release changes.\n"
|
|
186
|
-
if date == "2025-01-02":
|
|
187
|
-
release.validate_post_date(post, original)
|
|
188
|
-
else:
|
|
189
|
-
with pytest.raises(ValueError, match="retain the base release date"):
|
|
190
|
-
release.validate_post_date(post, original)
|
|
191
|
-
return None
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
@pytest.mark.parametrize("outcome", ["success", "failure", "skipped"])
|
|
195
|
-
def test_finalization_evidence(
|
|
196
|
-
tmp_path: Path, monkeypatch: pytest.MonkeyPatch, outcome: str
|
|
197
|
-
) -> None:
|
|
198
|
-
for key, value in {
|
|
199
|
-
"GITHUB_RUN_ID": "123",
|
|
200
|
-
"GITHUB_RUN_ATTEMPT": "2",
|
|
201
|
-
"BUNDLE_ID": "original-build-id",
|
|
202
|
-
"FINALIZE": outcome,
|
|
203
|
-
}.items():
|
|
204
|
-
monkeypatch.setenv(key, value)
|
|
205
|
-
release.record_finalization(tmp_path / "evidence")
|
|
206
|
-
assert json.loads((tmp_path / "evidence/finalization.json").read_text()) == {
|
|
207
|
-
"run_id": "123",
|
|
208
|
-
"run_attempt": "2",
|
|
209
|
-
"bundle_artifact_id": "original-build-id",
|
|
210
|
-
"finalize": outcome,
|
|
211
|
-
}
|
|
212
|
-
return None
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_json_logger-4.3.0.dev3 → python_json_logger-4.3.0rc1}/src/pythonjsonlogger/__init__.py
RENAMED
|
File without changes
|
{python_json_logger-4.3.0.dev3 → python_json_logger-4.3.0rc1}/src/pythonjsonlogger/defaults.py
RENAMED
|
File without changes
|
{python_json_logger-4.3.0.dev3 → python_json_logger-4.3.0rc1}/src/pythonjsonlogger/exception.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_json_logger-4.3.0.dev3 → python_json_logger-4.3.0rc1}/src/pythonjsonlogger/jsonlogger.py
RENAMED
|
File without changes
|
{python_json_logger-4.3.0.dev3 → python_json_logger-4.3.0rc1}/src/pythonjsonlogger/msgspec.py
RENAMED
|
File without changes
|
{python_json_logger-4.3.0.dev3 → python_json_logger-4.3.0rc1}/src/pythonjsonlogger/orjson.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_json_logger-4.3.0.dev3 → python_json_logger-4.3.0rc1}/tests/test_benchmark_report.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|