You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I'd quite like to have an option to have single-quoted strings be the default.
Problem as described by the Blue formatter ( https://blue.readthedocs.io/en/latest/ ):
"blue defaults to single-quoted strings. This is probably the most painful black choice to our eyes, and the thing that inspired blue. We strongly prefer using single quoted strings over double quoted strings for everything except docstrings and triple quoted strings (TQS). Don’t ask us why we prefer double-quotes for TQS; it just looks better to us! For all other strings, blue defaults to single quoted strings. In the case of docstrings, those always use TQS with double-quotes.
...
We’d prefer not to fork or monkeypatch. Instead, our hope is that eventually we’ll be able to work with the black maintainers to add just a little bit of configuration and merge back into the black project.
"
Describe the solution you'd like
Be able to specify an option to use single-quotes as the default instead of double-quotes (except for triple quoted strings). Much like the 'line length' option, something that people can optionally specify.
Describe alternatives you've considered
using blue formatter instead of black.
gritting my teeth and bearing it.
The text was updated successfully, but these errors were encountered:
Black's philosophy is to minimize formatting options so that formatted code looks consistent and users don't have to worry about formatting minutiae. When I first watched @ambv present about Black, I was also surprised he chose double quotes, but the choice has served us well.
My workaround has been to add black to gray (v0.10) then have gray call unify after black so that we can get the goodness of black without having to grit our teeth.
Now the issue is that black is incompatible with PEP 701 as reported in #3746, so we end up with files that are formatted in valid python 3.12 syntax but that Black is unable to parse again.
So if you are not on python 3.12 yet and do not like your 2 options, I suggest you take a look at it. Some of the nice things about gray is that it calls other formatting tools such as pyupgrade and isort. Thanks to this our internal codebase has improved well in readability.
BTW I did take a look at option 1, and switching from " to ' would be rather complicated, so it is not just a matter of preference but it would require tricky changes in the codebase.
Now that I'm aware of Blue ... I might add support for it in Gray so that should fix the PEP 701 issue we have and stop using unify.
Is your feature request related to a problem? Please describe.
I'd quite like to have an option to have single-quoted strings be the default.
Problem as described by the Blue formatter ( https://blue.readthedocs.io/en/latest/ ):
"blue defaults to single-quoted strings. This is probably the most painful black choice to our eyes, and the thing that inspired blue. We strongly prefer using single quoted strings over double quoted strings for everything except docstrings and triple quoted strings (TQS). Don’t ask us why we prefer double-quotes for TQS; it just looks better to us! For all other strings, blue defaults to single quoted strings. In the case of docstrings, those always use TQS with double-quotes.
...
We’d prefer not to fork or monkeypatch. Instead, our hope is that eventually we’ll be able to work with the black maintainers to add just a little bit of configuration and merge back into the black project.
"
Describe the solution you'd like
Be able to specify an option to use single-quotes as the default instead of double-quotes (except for triple quoted strings). Much like the 'line length' option, something that people can optionally specify.
Describe alternatives you've considered
The text was updated successfully, but these errors were encountered: