Skip to content

Prevent multi-line descriptions for crashing putup#509

Merged
abravalheri merged 2 commits into
masterfrom
issue-506-multiline-description
Oct 1, 2021
Merged

Prevent multi-line descriptions for crashing putup#509
abravalheri merged 2 commits into
masterfrom
issue-506-multiline-description

Conversation

@abravalheri
Copy link
Copy Markdown
Collaborator

Purpose

Users can decide to edit setup.cfg and change the description field to be a multi-line string.
This can break updates, because the current setup.cfg template depends on the fact it is a sinlge line (the INI/CFG syntax is broken otherwise).

This issue is related to #506.

Approach

When rendering the template use just the first line of the description.
Then use ConfigUpdater to fix it, if necessary, with set_values([ ... list of lines ...]).

… specially on updates when the user might have edited `setup.cfg`

This issue is related to #506.
@abravalheri abravalheri marked this pull request as ready for review September 30, 2021 18:08
@coveralls
Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 5711034905264128

  • 4 of 4 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.006%) to 97.291%

Totals Coverage Status
Change from base Build 5113446040600576: 0.006%
Covered Lines: 1637
Relevant Lines: 1669

💛 - Coveralls

Comment thread src/pyscaffold/templates/__init__.py Outdated
Comment thread src/pyscaffold/templates/__init__.py Outdated
@FlorianWilhelm
Copy link
Copy Markdown
Member

Thanks. Nice solution. Makes me think if maybe we could one day completely go for ConfigUpdater as template systems for setup.cfg. I think it would save us some code and avoid workarounds like this. But I am also not sure if this change would make sense when pyproject.toml will replace it anyway.

I added some comments to the code which I think makes it easier to understand what's going on. Feel free to merge @abravalheri. And thanks a lot again :-)

@abravalheri
Copy link
Copy Markdown
Collaborator Author

Yes, that would make sense.
I suppose a purely ConfigUpdater does not make sense, because it is just easier to add the structure and the comments in the plain text, but we could avoid doing any string interpolation and just fill the option values using ConfigUpdater. It should not be super-hard...

Let's see if we have any news about PEP 621 and setuptools in the near future. If not, we might want to invest sometime on this...

Thank you very much @FlorianWilhelm for the suggestions! I think they improve a lot the PR.

@abravalheri abravalheri merged commit d911b31 into master Oct 1, 2021
@abravalheri abravalheri deleted the issue-506-multiline-description branch October 1, 2021 13:45
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.

3 participants