13 buildPythonPackage rec {
18 disabled = pythonOlder "3.7";
21 inherit pname version;
22 hash = "sha256-TauKXtcTTibVfBZHx0g6+z8TaHi1eQYreGyboWuUY3s=";
25 build-system = [ setuptools ];
33 nativeCheckInputs = [ pytestCheckHook ];
36 changelog = "https://github.com/google/yapf/blob/v${version}/CHANGELOG.md";
37 homepage = "https://github.com/google/yapf";
38 description = "Yet Another Python Formatter";
40 Most of the current formatters for Python --- e.g., autopep8, and pep8ify
41 --- are made to remove lint errors from code. This has some obvious
42 limitations. For instance, code that conforms to the PEP 8 guidelines may
43 not be reformatted. But it doesn't mean that the code looks good.
45 YAPF takes a different approach. It's based off of 'clang-format',
46 developed by Daniel Jasper. In essence, the algorithm takes the code and
47 reformats it to the best formatting that conforms to the style guide, even
48 if the original code didn't violate the style guide. The idea is also
49 similar to the 'gofmt' tool for the Go programming language: end all holy
50 wars about formatting - if the whole codebase of a project is simply piped
51 through YAPF whenever modifications are made, the style remains consistent
52 throughout the project and there's no point arguing about style in every
55 The ultimate goal is that the code YAPF produces is as good as the code
56 that a programmer would write if they were following the style guide. It
57 takes away some of the drudgery of maintaining your code.
59 license = lib.licenses.asl20;
61 maintainers = with lib.maintainers; [