Skip to content

Fix #100: strip lines before parsing with Requirement() - #101

Merged
jensens merged 3 commits into
mainfrom
fix/100-strip-requirement-line
Aug 4, 2026
Merged

Fix #100: strip lines before parsing with Requirement()#101
jensens merged 3 commits into
mainfrom
fix/100-strip-requirement-line

Conversation

@jensens

@jensens jensens commented Aug 4, 2026

Copy link
Copy Markdown
Member

Bug

With packaging >= 26.3, Requirement() rejects strings with trailing whitespace. process_line() in src/mxdev/processing.py parses the raw line including its trailing newline; the raised InvalidRequirement is swallowed by the bare except, so packages configured as sources are no longer commented out in the generated requirements/constraints, and pip/uv resolution fails downstream (see #100).

Failing test

This PR first adds regression tests that pass lines with trailing \n/\r\n through process_line() and resolve_dependencies() — they fail on packaging >= 26.3 with the current code.

Next steps

  • Strip the line before parsing
  • Log unparseable lines at debug level instead of silently passing
  • CHANGES.md entry

Fixes #100

jensens added 3 commits August 4, 2026 22:32
packaging 26.3 rejects requirement strings with trailing whitespace.
process_line() passes the raw line including its newline to Requirement(),
the resulting InvalidRequirement is silently swallowed, and source
packages are no longer commented out in the generated constraints.
packaging 26.3 made requirement parsing strict: a trailing newline now
raises InvalidRequirement. process_line() parsed the raw line straight
from file iteration, the error was silently swallowed, and source
packages stayed pinned in the generated constraints.

Parse the stripped line instead, and log unparseable lines at debug
level so parser-behavior changes surface under -v instead of silently
producing downstream resolver errors.
@jensens
jensens marked this pull request as ready for review August 4, 2026 20:36
@jensens
jensens merged commit 997b453 into main Aug 4, 2026
17 checks passed
@jensens
jensens deleted the fix/100-strip-requirement-line branch August 4, 2026 20:37
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.

packaging 26.3 breaks disabling of source-package constraints (Requirement() now rejects trailing newline)

1 participant