python-json-logger 4.3.0.dev2__tar.gz → 4.3.0.dev3__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.
Files changed (32) hide show
  1. {python_json_logger-4.3.0.dev2/src/python_json_logger.egg-info → python_json_logger-4.3.0.dev3}/PKG-INFO +1 -1
  2. {python_json_logger-4.3.0.dev2 → python_json_logger-4.3.0.dev3}/pyproject.toml +1 -1
  3. {python_json_logger-4.3.0.dev2 → python_json_logger-4.3.0.dev3/src/python_json_logger.egg-info}/PKG-INFO +1 -1
  4. {python_json_logger-4.3.0.dev2 → python_json_logger-4.3.0.dev3}/tests/test_release.py +72 -44
  5. {python_json_logger-4.3.0.dev2 → python_json_logger-4.3.0.dev3}/LICENSE +0 -0
  6. {python_json_logger-4.3.0.dev2 → python_json_logger-4.3.0.dev3}/MANIFEST.in +0 -0
  7. {python_json_logger-4.3.0.dev2 → python_json_logger-4.3.0.dev3}/README.md +0 -0
  8. {python_json_logger-4.3.0.dev2 → python_json_logger-4.3.0.dev3}/scripts/benchmark_plots.py +0 -0
  9. {python_json_logger-4.3.0.dev2 → python_json_logger-4.3.0.dev3}/scripts/benchmark_report.py +0 -0
  10. {python_json_logger-4.3.0.dev2 → python_json_logger-4.3.0.dev3}/setup.cfg +0 -0
  11. {python_json_logger-4.3.0.dev2 → python_json_logger-4.3.0.dev3}/src/python_json_logger.egg-info/SOURCES.txt +0 -0
  12. {python_json_logger-4.3.0.dev2 → python_json_logger-4.3.0.dev3}/src/python_json_logger.egg-info/dependency_links.txt +0 -0
  13. {python_json_logger-4.3.0.dev2 → python_json_logger-4.3.0.dev3}/src/python_json_logger.egg-info/top_level.txt +0 -0
  14. {python_json_logger-4.3.0.dev2 → python_json_logger-4.3.0.dev3}/src/pythonjsonlogger/__init__.py +0 -0
  15. {python_json_logger-4.3.0.dev2 → python_json_logger-4.3.0.dev3}/src/pythonjsonlogger/core.py +0 -0
  16. {python_json_logger-4.3.0.dev2 → python_json_logger-4.3.0.dev3}/src/pythonjsonlogger/defaults.py +0 -0
  17. {python_json_logger-4.3.0.dev2 → python_json_logger-4.3.0.dev3}/src/pythonjsonlogger/exception.py +0 -0
  18. {python_json_logger-4.3.0.dev2 → python_json_logger-4.3.0.dev3}/src/pythonjsonlogger/json.py +0 -0
  19. {python_json_logger-4.3.0.dev2 → python_json_logger-4.3.0.dev3}/src/pythonjsonlogger/jsonlogger.py +0 -0
  20. {python_json_logger-4.3.0.dev2 → python_json_logger-4.3.0.dev3}/src/pythonjsonlogger/msgspec.py +0 -0
  21. {python_json_logger-4.3.0.dev2 → python_json_logger-4.3.0.dev3}/src/pythonjsonlogger/orjson.py +0 -0
  22. {python_json_logger-4.3.0.dev2 → python_json_logger-4.3.0.dev3}/src/pythonjsonlogger/py.typed +0 -0
  23. {python_json_logger-4.3.0.dev2 → python_json_logger-4.3.0.dev3}/src/pythonjsonlogger/utils.py +0 -0
  24. {python_json_logger-4.3.0.dev2 → python_json_logger-4.3.0.dev3}/tests/__init__.py +0 -0
  25. {python_json_logger-4.3.0.dev2 → python_json_logger-4.3.0.dev3}/tests/test_benchmark_report.py +0 -0
  26. {python_json_logger-4.3.0.dev2 → python_json_logger-4.3.0.dev3}/tests/test_cookbook.py +0 -0
  27. {python_json_logger-4.3.0.dev2 → python_json_logger-4.3.0.dev3}/tests/test_deprecation.py +0 -0
  28. {python_json_logger-4.3.0.dev2 → python_json_logger-4.3.0.dev3}/tests/test_dictconfig.py +0 -0
  29. {python_json_logger-4.3.0.dev2 → python_json_logger-4.3.0.dev3}/tests/test_formatters.py +0 -0
  30. {python_json_logger-4.3.0.dev2 → python_json_logger-4.3.0.dev3}/tests/test_missing.py +0 -0
  31. {python_json_logger-4.3.0.dev2 → python_json_logger-4.3.0.dev3}/tests/test_publish_docs.py +0 -0
  32. {python_json_logger-4.3.0.dev2 → python_json_logger-4.3.0.dev3}/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.0.dev2
3
+ Version: 4.3.0.dev3
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>
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "python-json-logger"
7
- version = "4.3.0.dev2"
7
+ version = "4.3.0.dev3"
8
8
  description = "JSON Log Formatter for the Python Logging Package"
9
9
  authors = [
10
10
  {name = "Zakaria Zajac", email = "zak@madzak.com"},
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-json-logger
3
- Version: 4.3.0.dev2
3
+ Version: 4.3.0.dev3
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>
@@ -98,23 +98,54 @@ def test_postrelease_preserves_original_date() -> None:
98
98
  return None
99
99
 
100
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
+
101
113
  @pytest.mark.parametrize(
102
- "existing,expected",
103
- [
104
- ({}, {"wheel", "sdist"}),
105
- ({"wheel": "aaa"}, {"sdist"}),
106
- ({"wheel": "aaa", "sdist": "bbb"}, set()),
107
- ],
114
+ "existing", [None, {}, {"wheel": "aaa"}, {"wheel": "wrong", "sdist": "bbb"}]
108
115
  )
109
- def test_missing_files(existing: dict[str, str], expected: set[str]) -> None:
110
- assert release.missing_files({"wheel": "aaa", "sdist": "bbb"}, existing) == expected
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
111
130
  return None
112
131
 
113
132
 
114
- @pytest.mark.parametrize("existing", [{"wheel": "wrong"}, {"unexpected": "aaa"}])
115
- def test_conflicting_pypi_files(existing: dict[str, str]) -> None:
116
- with pytest.raises(ValueError, match="conflict"):
117
- release.missing_files({"wheel": "aaa", "sdist": "bbb"}, existing)
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")
118
149
  return None
119
150
 
120
151
 
@@ -128,50 +159,26 @@ def test_bundle_identity_and_checksums(tmp_path: Path, monkeypatch: pytest.Monke
128
159
  (tmp_path / "SHA256SUMS.json").write_text(
129
160
  json.dumps({name: hashlib.sha256(content).hexdigest() for name, content in files.items()})
130
161
  )
131
- (tmp_path / "release.json").write_text(json.dumps({"tag": "v4.3.0", "commit": "abc"}))
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")
132
166
  monkeypatch.setenv("GITHUB_REF_NAME", "v4.3.0")
133
167
  monkeypatch.setenv("GITHUB_SHA", "wrong")
134
168
  with pytest.raises(ValueError, match="commit mismatch"):
135
169
  release.verify_bundle(tmp_path)
136
170
  monkeypatch.setenv("GITHUB_SHA", "abc")
137
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")
138
176
  (directory / "package.whl").write_bytes(b"corrupted")
139
177
  with pytest.raises(ValueError, match="checksum mismatch"):
140
178
  release.verify_bundle(tmp_path)
141
179
  return None
142
180
 
143
181
 
144
- def test_workflow_permissions_and_order() -> None:
145
- yaml = pytest.importorskip("yaml")
146
- text = (ROOT / ".github/workflows/release.yml").read_text()
147
- workflow = yaml.load(text, Loader=yaml.BaseLoader)
148
- assert "python - <<" not in text
149
- assert workflow["on"] == {"push": {"tags": ["v[0-9]*.[0-9]*.[0-9]*"]}}
150
- assert workflow["permissions"] == {"contents": "read"}
151
- jobs = workflow["jobs"]
152
- for job, dependency in (
153
- ("ci", "validate"),
154
- ("draft", "build"),
155
- ("select", "draft"),
156
- ("publish", "select"),
157
- ):
158
- assert jobs[job]["needs"] == dependency
159
- for name, job in jobs.items():
160
- permissions = job.get("permissions", {})
161
- assert (permissions.get("contents") == "write") == (name in ("draft", "publish"))
162
- assert (permissions.get("id-token") == "write") == (name == "publish")
163
- for step in job.get("steps", []):
164
- if "uses" in step:
165
- assert len(step["uses"].split("@")[1]) == 40
166
- assert jobs["publish"]["environment"]["name"] == "pypi"
167
- assert not any("scripts/" in step.get("run", "") for step in jobs["publish"]["steps"])
168
- steps = jobs["publish"]["steps"]
169
- assert "gh release edit" in steps[-2]["run"]
170
- assert "pypa/gh-action-pypi-publish@" in steps[-1]["uses"]
171
- assert not any("checkout" in step.get("uses", "") for step in jobs["publish"]["steps"])
172
- return None
173
-
174
-
175
182
  @pytest.mark.parametrize("date", ["2025-01-02", "2026-01-02"])
176
183
  def test_postrelease_date_policy(date: str) -> None:
177
184
  original = "## [4.2.0](compare) - 2025-01-02\n\n- Original changes.\n"
@@ -182,3 +189,24 @@ def test_postrelease_date_policy(date: str) -> None:
182
189
  with pytest.raises(ValueError, match="retain the base release date"):
183
190
  release.validate_post_date(post, original)
184
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