1{ lib
2, buildPythonPackage
3, fetchPypi
4, nose
5}:
6
7buildPythonPackage rec {
8 pname = "yapf";
9 version = "0.32.0";
10
11 src = fetchPypi {
12 inherit pname version;
13 hash = "sha256-o/UIXTfvfj4ATEup+bPkDFT/GQHNER8FFFrjE6fGfRs=";
14 };
15
16 checkInputs = [
17 nose
18 ];
19
20 meta = with lib; {
21 homepage = "https://github.com/google/yapf";
22 description = "Yet Another Python Formatter";
23 longDescription = ''
24 Most of the current formatters for Python --- e.g., autopep8, and pep8ify
25 --- are made to remove lint errors from code. This has some obvious
26 limitations. For instance, code that conforms to the PEP 8 guidelines may
27 not be reformatted. But it doesn't mean that the code looks good.
28
29 YAPF takes a different approach. It's based off of 'clang-format',
30 developed by Daniel Jasper. In essence, the algorithm takes the code and
31 reformats it to the best formatting that conforms to the style guide, even
32 if the original code didn't violate the style guide. The idea is also
33 similar to the 'gofmt' tool for the Go programming language: end all holy
34 wars about formatting - if the whole codebase of a project is simply piped
35 through YAPF whenever modifications are made, the style remains consistent
36 throughout the project and there's no point arguing about style in every
37 code review.
38
39 The ultimate goal is that the code YAPF produces is as good as the code
40 that a programmer would write if they were following the style guide. It
41 takes away some of the drudgery of maintaining your code.
42 '';
43 license = licenses.asl20;
44 maintainers = with maintainers; [ AndersonTorres siddharthist ];
45 };
46}