Skip to content

DEV: Detect minor version bumps in make_release.py - #3969

Merged
stefan6419846 merged 3 commits into
py-pdf:mainfrom
RavSinghChandan:fix-release-minor-bump
Aug 19, 2026
Merged

stefan6419846 merged 3 commits into
py-pdf:mainfrom
RavSinghChandan:fix-release-minor-bump

Conversation

@RavSinghChandan

Copy link
Copy Markdown
Contributor

Closes #3963.

version_bump always increased the patch version — the comment even says
"just assume a patch version change" — so every release with an enhancement
had to be corrected by hand at the interactive prompt.

The formatted changes already carry the answer: get_formatted_changes
emits an ### New Features (ENH) or ### Deprecations (DEP) section
exactly when the release warrants a minor bump. So I pass the changes into
version_bump and key off those two section headers.

I checked the rule against the changelog before implementing it: it holds
for all 39 releases recorded there, and the function reproduces all 38
version transitions between them. Major bumps stay manual, and the
interactive prompt still lets you override the suggestion.

Added tests — make_release.py had none.

Closes py-pdf#3963.

`version_bump` always increased the patch version -- "just assume a patch
version change" -- so every release with an enhancement had to be corrected
by hand at the interactive prompt.

The formatted changes already carry the answer: `get_formatted_changes`
emits an `### New Features (ENH)` or `### Deprecations (DEP)` section
exactly when the release warrants a minor bump. Pass the changes into
`version_bump` and key off those two section headers.

Checked against the changelog: this rule holds for all 39 releases
recorded there, and the function reproduces all 38 version transitions
between them. Major bumps stay manual, and the interactive prompt still
lets the release manager override the suggestion.

Added tests -- make_release.py had none.
@codecov

codecov Bot commented Aug 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.94%. Comparing base (1bce7a7) to head (7d2126e).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3969   +/-   ##
=======================================
  Coverage   97.94%   97.94%           
=======================================
  Files          57       57           
  Lines       11031    11031           
  Branches     2065     2065           
=======================================
  Hits        10804    10804           
  Misses        126      126           
  Partials      101      101           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@stefan6419846

Copy link
Copy Markdown
Collaborator

Added tests — make_release.py had none.

This is wrong. Please move the tests to the existing file https://github.com/py-pdf/pypdf/blob/main/tests/scripts/test_make_release.py

They belong alongside the existing tests for this script, and follow its
pytest.importorskip convention rather than a module-level import.
@RavSinghChandan

Copy link
Copy Markdown
Contributor Author

You're right, sorry - I did not check tests/scripts/ before adding that file.
Moved the tests into tests/scripts/test_make_release.py alongside the existing
ones, and switched them to the pytest.importorskip convention used there rather
than a module-level import.

Comment thread tests/scripts/test_make_release.py Resolved
The existing case used a bare ENH, which passes even without the
startswith("### ") guard. A message containing (ENH) exactly as the
header spells it is the case that actually exercises it.
@RavSinghChandan

Copy link
Copy Markdown
Contributor Author

Good catch - the case I had used a bare ENH, which passes even without the
startswith("### ") guard, so it wasn't really testing anything. Added one with
(ENH) written exactly as the header spells it. That one does fail if I remove
the guard.

@stefan6419846
stefan6419846 merged commit bb62d06 into py-pdf:main Aug 19, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

make_release.py: Automatically detect minor version bumps

2 participants