zestsoftware / zest.releaser

Python software releasing made easy and repeatable
https://zestreleaser.readthedocs.io
GNU General Public License v2.0
198 stars 62 forks source link

Black's default preference for double quotes dislikes our single quotes #301

Closed reinout closed 5 years ago

reinout commented 5 years ago

I'm experimenting with the "black" (https://black.readthedocs.io/) code formatter and I like it.

One problem: black prefers double quotes, like this:

version = "0.1"

but zest.releaser writes:

version = '0.1'

I think we ought to fix this. Using double quotes ourselves would be the easiest solution. Alternatively we'd have to detect the quoting style.

mauritsvanrees commented 5 years ago

I have experimented as well a few weeks or so ago, and like it too. We can add a pyproject.toml file with as contents:

[tool.black]
skip-string-normalization = true

See comments in this CMFPlone PR. The current Plone style guide recommends single quotes, so in Plone we would need such a config, to not make cleanups by black crazy big.

reinout commented 5 years ago

It sounds like you want to run black on zest.releaser's own codebase. Good idea, but then we should first merge/reject/fix/cleanup all the outstanding pull requests. (And I'm fine with the double quotes, as single quotes have a tendency to show up in strings quite a lot (like in "Reinout's great idea").

This issue is about all the other projects out there that use zest.releaser. We inject a single-quoted version = '1.0' into the setup.py. We'd be forcing the skip-string-normalization = True setting on all those projects (which I don't want).

But... reading that plone PR, I get the impression that it is fine to just use double quotes in our injected version string? Plone's black settings won't complain about it. Would that be acceptable?

reinout commented 5 years ago

@mauritsvanrees: you don't need to release yet, I want to look at #299 right now :-)