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