Format Python Code Using YAPF
leimao.github.io
Format Python Code Using YAPF
1–10 of 67 posts
Re: Format Python Code Using YAPF
#2Re: Format Python Code Using YAPF
#3Seriously, use Black. I my experience, and to my taste, it works perfectly all the time, and the result is beautiful.
It's also pep8 compliant, for the parts of pep8 that are concerned by a reformatter.
Re: Format Python Code Using YAPF
#4I thought the community standardized on black
I personally love black though.
Re: Format Python Code Using YAPF
#5I thought the community standardized on black
black is opinionated. If you disagree with black's opinions then a negotiable formatter like YAPF might be better. I personally love black though.
Rust's "cargo fmt" tool is similarly good.
Re: Format Python Code Using YAPF
#6Re: Format Python Code Using YAPF
#7I thought the community standardized on black
Re: Format Python Code Using YAPF
#8I thought the community standardized on black
I tried to PR a --use-tabs flag but the PR was rejected without comments. Had to fork Black to be able to use it. Tan is a drop-in replacement that allows --use-tabs (and use-tabs = true in pyproject.toml).
Re: Format Python Code Using YAPF
#9I've used Yapf for a year, then switched to Black when it appeared. Seriously, use Black. I my experience, and to my taste, it works perfectly all the time, and the result is beautiful. It's also pep8 compliant, for the parts of pep8 that are concerned by a reformatter.
Black removes any additional parentheses added to enable a line split at a reasonable position (such as "and"). With those removed, black has to split at weird locations like at a function call.
But switching to black just for the speed increase is reasonable.
Re: Format Python Code Using YAPF
#10I've used Yapf for a year, then switched to Black when it appeared. Seriously, use Black. I my experience, and to my taste, it works perfectly all the time, and the result is beautiful. It's also pep8 compliant, for the parts of pep8 that are concerned by a reformatter.