Skip to content

Repair Descriptions with newlines and emit a warning#2538

Merged
jaraco merged 1 commit into
mainfrom
bugfix/1390-lenient-description
Jan 17, 2021
Merged

Repair Descriptions with newlines and emit a warning#2538
jaraco merged 1 commit into
mainfrom
bugfix/1390-lenient-description

Conversation

@jaraco

@jaraco jaraco commented Jan 17, 2021

Copy link
Copy Markdown
Member

Closes #1390

Pull Request Checklist

  • Changes have tests
  • News fragment added

@alexshpilkin

Copy link
Copy Markdown

Nit: maybe it’d also make sense to str.rstrip() broken descriptions? My guess is that most descriptions with newlines have one at the end. If careless usage of multiline strings (see e.g. PyLops/pyproximal@90d37d0) is frequent enough, it might also make sense to handle newlines and spaces at the beginning as well, and so str.strip() the descriptions instead.

@jaraco

jaraco commented Jan 17, 2021

Copy link
Copy Markdown
Member Author

Good point, although I do want to be cautious and not overcorrect here. If somehow a space is already present at the beginning or end of the description, I wouldn't want to alter that as part of correcting for newlines, even if that is the correct thing to do. On the other hand, converting a trailing or leading newline to a space seems janky at best.

I think for now I'll stick with this approach, as it still will correct the underlying defect (that metadata gets corrupted) and provide a path forward. I'll defer more sophisticated validation to subsequent efforts (which probably should happen earlier than when writing values out and probably coordinated across multiple forms of input such as setup.py or setup.cfg).

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.

Newlines in the description field produce a malformed PKG-INFO

2 participants