Visitar URL original
Stop publishing a diff against the previous release · winpython/winpython@c9f6ea4 · GitHub
Skip to content

Commit c9f6ea4

Browse files
stonebigclaude
andcommitted
Stop publishing a diff against the previous release
A _History.md compares a release against the one immediately before it, and that chain carries no meaning: flavors are not stable across cycles, one appearing while another goes away, and readers upgrade about once a year rather than every cycle. So the comparison it offers is one almost nobody is asking for. The cycle's changelog pull request now files the package index, the lock file and the requirements, and nothing else. Each of those describes its own release; readers wanting a comparison pick their own two indexes with wppm -diff. The histories already in changelogs/ stay where they are. The local build still writes one, beside its output where the person running the build reads it before publishing anything -- it is the useful view there. It is no longer copied into changelogs/, which is what turned it into a published artifact. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 960af94 commit c9f6ea4

4 files changed

Lines changed: 36 additions & 41 deletions

File tree

‎.github/scripts/changelog_files.py‎

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""File a cycle's build output into changelogs/, and write the histories.
1+
"""File a cycle's build output into changelogs/.
22
33
python .github/scripts/changelog_files.py <downloaded metadata> changelogs
44
@@ -8,10 +8,13 @@
88
The fourth, hashes_<winpyver>.md, describes the binaries of one build rather
99
than the release, and stays out.
1010
11-
The _History.md companions are then written here rather than shipped from the
12-
build, because a history is a comparison against the *previous* release, and
13-
only a checkout of the repository has that to compare against. Ordering is
14-
`wppm.diff`'s job; this decides what to hand it.
11+
No _History.md companion is written. A history compares a release against the
12+
one immediately before it, and that chain carries no meaning: flavors are not
13+
stable across cycles -- one may appear while another goes away -- and people
14+
upgrade about once a year rather than every cycle, so a diff against the
15+
predecessor answers a question almost nobody asks. What is useful is comparing
16+
two package indexes of the reader's own choosing, which `wppm -diff` does
17+
against any two of the files this script files.
1518
1619
"""
1720
import re
@@ -26,7 +29,6 @@
2629
# which installs none -- nothing at all.
2730
sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
2831

29-
from wppm import diff # noqa: E402 the path above has to be set first
3032
from wppm.diff import version # noqa: E402 packaging, or pip's vendored copy
3133

3234
# WinPythonslim-64bit-3.15.0.5b1.md -- the flavor may be empty, and the version
@@ -42,7 +44,7 @@ def parse_changelog_name(name: str):
4244
try:
4345
version.parse(match.group("version"))
4446
except version.InvalidVersion:
45-
return None # the _History companions land here, as they should
47+
return None # anything whose tail is not a version is not an index
4648
return match.group("flavor"), int(match.group("arch")), match.group("version")
4749

4850

@@ -78,22 +80,8 @@ def main(argv: list[str]) -> None:
7880
raise SystemExit(f"{source} held no changelog, lock file or requirements")
7981
for name in filed:
8082
print(f"filed {name}")
81-
82-
# every package index has to be in place before any history is written: a
83-
# history reads the index of the release it compares against, which for the
84-
# second flavor of a cycle may well be the one just copied
85-
histories = 0
86-
for name in filed:
87-
parsed = parse_changelog_name(name)
88-
if not parsed:
89-
continue
90-
flavor, architecture, ver = parsed
91-
previous = diff.find_previous_version(ver, changelogs, flavor, architecture)
92-
diff.write_changelog(ver, None, changelogs, flavor, architecture)
93-
histories += 1
94-
against = "nothing earlier" if previous == ver else previous
95-
print(f"history WinPython{flavor}-{architecture}bit-{ver} vs {against}")
96-
print(f"\n{len(filed)} file(s) filed, {histories} history file(s) written")
83+
indexes = sum(1 for name in filed if parse_changelog_name(name))
84+
print(f"\n{len(filed)} file(s) filed, {indexes} package index(es)")
9785

9886

9987
if __name__ == "__main__":

‎.github/workflows/build_winpython_cycle.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ jobs:
243243
merge-multiple: true
244244
path: release_metadata
245245

246-
- name: File the changelogs and write the histories
246+
- name: File the changelogs
247247
run: python .github/scripts/changelog_files.py release_metadata changelogs
248248

249249
- name: Open the changelog pull request
@@ -271,5 +271,5 @@ jobs:
271271
else
272272
gh pr create --base "$BASE" --head "$branch" \
273273
--title "Changelogs for $TITLE" \
274-
--body "Package indexes, lock files and requirements for every leg of \`$TAG\`, with the \`_History.md\` companions written against the previous release. Filed by the build that produced them, rather than copied by hand."
274+
--body "Package indexes, lock files and requirements for every leg of \`$TAG\`, filed by the build that produced them rather than copied by hand. Compare any two of them with \`wppm -diff <a>.md <b>.md\`."
275275
fi

‎tests/test_changelog_files.py‎

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
and has never been kept there. Getting that wrong is quiet: the wrong file is
77
committed and nothing complains, so the selection is pinned here.
88
9-
The `_History.md` companions are written from the checkout rather than shipped
10-
by the build, because a history compares against the *previous* release, which
11-
only the repository has.
9+
No `_History.md` companion is written. A history compares a release against
10+
the one immediately before it, and that chain carries no meaning: flavors come
11+
and go between cycles, and readers upgrade about once a year rather than every
12+
cycle. The comparison that is wanted is between two indexes of the reader's own
13+
choosing -- `wppm -diff a.md b.md` -- so the absence is pinned here too.
1214
"""
1315
import importlib.util
1416
import os
@@ -146,28 +148,25 @@ def test_wppm_comes_from_the_checkout(self, cycle, tmp_path):
146148
assert proc.returncode == 0, proc.stderr
147149
assert "decoy" not in proc.stderr
148150

149-
def test_files_the_three_and_writes_the_history(self, cycle, tmp_path):
151+
def test_files_the_three_and_nothing_else(self, cycle, tmp_path):
150152
source, changelogs = cycle
151153
proc = run_script(source, changelogs, cwd=tmp_path)
152154
assert proc.returncode == 0, proc.stderr
153155
landed = sorted(p.name for p in changelogs.iterdir())
154156
assert landed == [
155-
"WinPythonslim-64bit-3.15.0.4.md", # was already there
156-
"WinPythonslim-64bit-3.15.0.5b1.md", # filed
157-
"WinPythonslim-64bit-3.15.0.5b1_History.md", # written
157+
"WinPythonslim-64bit-3.15.0.4.md", # was already there
158+
"WinPythonslim-64bit-3.15.0.5b1.md", # filed
158159
"pylock.64-3_15_0_5slimb1.toml",
159160
"requir.64-3_15_0_5slimb1.txt",
160161
]
161162

162-
def test_the_history_names_the_release_it_compares_against(self, cycle, tmp_path):
163+
def test_no_history_is_written_against_the_previous_release(self, cycle, tmp_path):
164+
"""Deliberate: see the module docstring. Not an oversight to restore."""
163165
source, changelogs = cycle
164166
proc = run_script(source, changelogs, cwd=tmp_path)
165167
assert proc.returncode == 0, proc.stderr
166-
history = (changelogs / "WinPythonslim-64bit-3.15.0.5b1_History.md").read_text(
167-
encoding="utf-8"
168-
)
169-
assert "since version 3.15.0.4slim" in history
170-
assert "3.15.0.5b1slim" in history
168+
assert not list(changelogs.glob("*_History.md"))
169+
assert "history" not in proc.stdout.lower()
171170

172171
def test_an_empty_metadata_directory_is_an_error(self, tmp_path):
173172
"""Silence here would commit nothing and call it a success."""

‎winpython/build_winpython.py‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,15 +328,23 @@ def main():
328328
)]
329329
run_command(cmd, shell=True)
330330
shutil.copyfile (winpydirbase.parent / mdn, changelog_dir / mdn)
331-
331+
332+
# What moved since the previous build of this flavor -- for the person
333+
# running the build, who wants to see it before publishing anything. It
334+
# stays beside the build output and is NOT copied into changelogs/: the
335+
# archive keeps the package indexes, and a diff against the immediately
336+
# previous release is not a useful thing to publish, since flavors come and
337+
# go between cycles and readers upgrade about once a year. Anyone wanting a
338+
# comparison picks their own two indexes with `wppm -diff <a>.md <b>.md`.
339+
# The previous index is still read from changelog_dir, which holds them all.
332340
cmd = [str(target_python), "-X", "utf8", "-c",
333341
(
334342
"from wppm import diff;"
335343
f"result = diff.compare_package_indexes('{changelog_version}', searchdir=r'{changelog_dir}', flavor=r'{args.flavor}', architecture={args.arch});"
336-
f"open(r'{winpydirbase.parent / out}', 'w', encoding='utf-8').write(result)"
344+
f"open(r'{winpydirbase.parent / out}', 'w', encoding='utf-8').write(result)"
337345
)]
338346
run_command(cmd, check=False)
339-
shutil.copyfile (winpydirbase.parent / out, changelog_dir / out)
347+
logging.info(f"changes since the previous {args.flavor or 'plain'} build: {winpydirbase.parent / out}")
340348

341349
if args.create_installer != "":
342350
log_section("🙏 Step 8: Create Installer")

0 commit comments

Comments
 (0)