Comments (2)
I would suggest alternative 2.
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.
from black.
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.
https://github.com/dizballanze/gray
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
.
from black.
Related Issues (20)
- Preview style feedback: Parenthesizing long dict, conditional, and type annotations HOT 6
- Black fails to format complicated f-string HOT 2
- What can I / should I expect when working with huge files (100 MB+)? HOT 1
- `wrap_long_dict_value_in_parens` can introduce unnecessary nesting for dicts in dicts
- Installation and update of black over a docker container HOT 1
- f-string with internal same-quote expression HOT 1
- Error on invalid configuration HOT 6
- Method argument values as multi-line strings and continuation visual indents HOT 1
- Whitespace before `fmt: skip` comment is normalised HOT 8
- Possible to format a Python code contained in a string variable? HOT 1
- Formatting of long lines only work when line-length is specified HOT 2
- Inconsistent formatting of `**` in tenary expression. HOT 2
- Can not format `method` code when method str parameter length default value too long HOT 5
- INTERNAL ERROR: Black produced invalid code: f-string: expecting '}' HOT 7
- [ISSUE] Github Action Black failing after successful reformatting. HOT 1
- wrap_long_dict_values_in_parens can remove parentheses HOT 1
- `multiline_string_handling` sometimes leads to worse formatting HOT 6
- Can we add a json schema to complete pyproject.toml's `[tool.black]`? HOT 9
- Latest docker images fail with an ImportError HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from black.