Closed johanfleury closed 3 years ago
Yes I support this. Please take a look at all the options, eg. yapf
too, for a comparison. One thing that would be good is if whatever format tool is utilized that it's consistent from release to release, so that people don't need the exact same version to produce the same results.
Please take a look at all the options, eg. yapf too, for a comparison
I only use black and never tested yapf.
I think yapf has more customization option (which can be good or bad depending on the context), but in the end they achieve the same goal. On the other hand, I think black has a bigger popularity (but I don’t have any metrics to support that statement).
It also seems that yapf doesn’t deal with standardizing quotes.
I found this article that describes their behaviors in details: Auto formatters for Python 👨💻🤖.
One thing that would be good is if whatever format tool is utilized that it's consistent from release to release, so that people don't need the exact same version to produce the same results.
I’m using black for quite some time now and never noticed big changes induced by new release.
In the end I think this is your call to make. I have a preference for black, but not a strong opinion on this.
While working on #81 I saw that their seems to be no standardized coding style throughout the project.
Here are a few examples of things I think could be fixed:
str.format()
What I would like to suggest is using something like black (which is an equivalent to
go fmt
) to standardize the code style. black has a test mode that can be used in CI to test that a PR is well formated.One is not encouraged to derive from black’s default configuration, but it can still be tweaked (to some extent) with some settings in
pyproject.toml
.Given the previous example, running
black --check --diff -t py36
would do something like that:Regarding string formatting, I would suggest to drop %-formatted string and use either the new f-strings if there’s no intent to be compatible with Python versions older that 3.6 (2016) or the
str.format
if compatibility with older version is a issue.I can propose a PR if you’re ok with this proposal.