Honor but deprecate newlines when processing keywords/platforms#347
Merged
Conversation
Newlines in `keywords` or `platforms` can break the produced metadata in PKG-INFO or METADATA files. Fixes: pypa/setuptools#4887
Member
|
Thanks for this proposal. My instinct is it would be better to guide users toward one best format, preferably something with proper syntax support, i.e. a full sequence of values, whether in Python or toml. What do you think about instead deprecating anything but |
jaraco
reviewed
Jul 5, 2026
Rather than silently joining newline-separated items with spaces, treat each line as a separate item (replacing newlines with commas) and warn that the behavior is deprecated, since newlines were never a valid separator for these fields. Extract the repair into a documented helper. Ref pypa/setuptools#4887 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
jaraco
reviewed
Jul 5, 2026
jaraco
reviewed
Jul 5, 2026
- Emit a plain (UserWarning) rather than DeprecationWarning, which is suppressed by default and wouldn't reach setuptools users (per the distutils.log.Log precedent). - Drop empty items so consecutive/leading/trailing newlines don't create blank keywords; cover this in the tests. - Reframe the news and docstring as forgiving invalid input rather than implying newlines followed any specification.
jaraco
reviewed
Jul 5, 2026
Replace the hand-rolled comma split/strip/drop-empties with the reusable jaraco.text.SeparatedValues, promoting jaraco.text to a runtime dependency. _repair_newlines still handles the invalid-newline repair and deprecation.
# Conflicts: # pyproject.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Newlines in
keywordsorplatformscan breakthe produced metadata in PKG-INFO or METADATA files.
Fixes: pypa/setuptools#4887
Another possibility is to raise an error if
keywordsorplatformscontain newlines but this fix is simple and backward-compatible and does not break projects that have multiline definitions of those attributes.