Skip to content

Enforce the requirements/pyproject invariant, and stop pointless floor bumps - #55

Merged
SackOfHacks merged 1 commit into
mainfrom
fix/manifest-sync-invariant
Sep 13, 2026
Merged

SackOfHacks merged 1 commit into
mainfrom
fix/manifest-sync-invariant

Conversation

@SackOfHacks

Copy link
Copy Markdown
Owner

Closes the root cause behind #54 rather than merging it.

The invariant was a comment, not a control

requirements.txt has always said "Keep in sync with pyproject.toml [project.dependencies]", and nothing checked it. #54 proposed raising tomli>=2.0.1>=2.4.1 in requirements.txt alone, which would have left the two manifests disagreeing on the first line it touched — and silently, since pip install pcapper resolves from pyproject.toml, so the requirements floor has no effect on what anyone actually gets.

TestRequirementsMatchPyproject now compares both dependency sets with whitespace and quote noise normalised away, so tomli's environment marker doesn't read as a false difference. Verified it bites by simulating #54 against the real files:

DETECTED DRIFT:
  only in requirements.txt: ['tomli>=2.4.1;python_version<"3.11"']
  only in pyproject.toml:   ['tomli>=2.0.1;python_version<"3.11"']

A second case asserts the parse is non-empty, so an empty read can't make the comparison vacuous.

And the reason that PR existed at all

Dependabot's pip default versioning-strategy is increase — it raises a >= floor on every upstream release, whether or not anything needs it. That is what generated a tomli bump with no security advisory behind it. increase-if-necessary moves a floor only when the current constraint genuinely excludes the new version; security updates still raise floors when they have to.

Lands in test_packaging.py beside the version-drift and missing-subpackage guards — same class of defect, invisible from the source tree, caught by an assertion instead of a comment.

…r bumps

requirements.txt has said "Keep in sync with pyproject.toml
[project.dependencies]" since it was written, and nothing enforced it.
Dependabot then proposed raising tomli>=2.0.1 to >=2.4.1 in
requirements.txt alone (#54), which would have left the two manifests
disagreeing on the first line it touched -- silently, since installs
resolve from pyproject.toml, so the requirements floor has no effect on
what a user actually gets. A manual-sync comment is not a control.

TestRequirementsMatchPyproject compares the two dependency sets with
whitespace and quote noise normalised away, so the environment marker
on tomli does not produce a false difference. Verified it bites by
simulating #54: it names tomli>=2.4.1 as present only in
requirements.txt. A second case asserts the parse is non-empty, so an
empty read cannot make the comparison vacuous.

The second half is the reason that PR existed at all. Dependabot's pip
default versioning-strategy is "increase", which raises a `>=` floor on
every upstream release whether or not anything needs it -- proposing
churn with no security driver, and dropping support for environments
the code runs on perfectly well. increase-if-necessary moves a floor
only when the existing constraint genuinely excludes the new version.
Security updates still raise floors when they have to.
@SackOfHacks
SackOfHacks merged commit 355fa1d into main Sep 13, 2026
4 checks passed
@SackOfHacks
SackOfHacks deleted the fix/manifest-sync-invariant branch September 13, 2026 17:39
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.

1 participant