Recommended autoformatters? #931
Open
Comments
|
@cxong Agreed, would be great to expand this section. Personally I'm a big fan of |
|
I've only used black a little, so I don't think I have enough experience to author this section. Happy for someone else to take it up in the meantime. |
|
@dbader I'm thinking about adding a PR for this. Do you think this is still relevant? I'd add a sub section about auto-formatting giving brief instructions on how to install and use autopep8, yapf, and black. |
|
@schilli91 Yes I think that'd be beautiful! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the Code Style document https://github.com/realpython/python-guide/blob/master/docs/writing/style.rst there's a small mention of autopep8 which can be used to format code to meet PEP8 standards. But there's at least two other autoformatters (black and yapf) which are as good if not better. There's a blog comparing the three here: https://medium.com/3yourmind/auto-formatters-for-python-8925065f9505
The gist of it is: autopep8 is the most conservative, black is the most opinionated, and yapf is somewhere in between depending on how you configure it.
Should the python guide have an opinion on which auto formatters should be used? In addition to the current mention of autopep8. I think it would be good to expand this section; auto formatters are quite useful and of great interest to developers coming from tools like gofmt and prettier.
The text was updated successfully, but these errors were encountered: