From dfc5a87d5be14927a6db9b4c703588730b10ca0e Mon Sep 17 00:00:00 2001 From: AndersonTorres Date: Wed, 17 Mar 2021 16:38:07 -0300 Subject: [PATCH 1/2] pythonPackages.yapf: 0.30.0 -> 0.31.0 --- .../python-modules/yapf/default.nix | 43 +++++++++++++++---- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/pkgs/development/python-modules/yapf/default.nix b/pkgs/development/python-modules/yapf/default.nix index 9c0e9d35399387..9c759f3a2b7e9b 100644 --- a/pkgs/development/python-modules/yapf/default.nix +++ b/pkgs/development/python-modules/yapf/default.nix @@ -1,19 +1,46 @@ -{ lib, buildPythonPackage, fetchPypi }: +{ lib +, buildPythonPackage +, fetchPypi +, nose +}: buildPythonPackage rec { pname = "yapf"; - version = "0.30.0"; + version = "0.31.0"; src = fetchPypi { inherit pname version; - sha256 = "3000abee4c28daebad55da6c85f3cd07b8062ce48e2e9943c8da1b9667d48427"; + hash = "sha256-QI+5orJUwwL0nbg8WfmqC0sP0OwlvjpcURgTJ5Iv9j0="; }; + checkInputs = [ + nose + ]; + meta = with lib; { - description = "A formatter for Python code."; - homepage = "https://github.com/google/yapf"; - license = licenses.asl20; - maintainers = with maintainers; [ siddharthist ]; - }; + homepage = "https://github.com/google/yapf"; + description = "Yet Another Python Formatter"; + longDescription = '' + Most of the current formatters for Python --- e.g., autopep8, and pep8ify + --- are made to remove lint errors from code. This has some obvious + limitations. For instance, code that conforms to the PEP 8 guidelines may + not be reformatted. But it doesn't mean that the code looks good. + YAPF takes a different approach. It's based off of 'clang-format', + developed by Daniel Jasper. In essence, the algorithm takes the code and + reformats it to the best formatting that conforms to the style guide, even + if the original code didn't violate the style guide. The idea is also + similar to the 'gofmt' tool for the Go programming language: end all holy + wars about formatting - if the whole codebase of a project is simply piped + through YAPF whenever modifications are made, the style remains consistent + throughout the project and there's no point arguing about style in every + code review. + + The ultimate goal is that the code YAPF produces is as good as the code + that a programmer would write if they were following the style guide. It + takes away some of the drudgery of maintaining your code. + ''; + license = licenses.asl20; + maintainers = with maintainers; [ AndersonTorres siddharthist ]; + }; } From 4cfce71f31774d357629e3a9e45610972052bc91 Mon Sep 17 00:00:00 2001 From: AndersonTorres Date: Wed, 17 Mar 2021 16:38:51 -0300 Subject: [PATCH 2/2] yapf: expose it via all-packages.nix --- pkgs/top-level/all-packages.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 8b40b3f8877e54..a001a42d8eb585 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9360,6 +9360,8 @@ in yafaray-core = callPackage ../tools/graphics/yafaray-core { }; + yapf = with python3Packages; toPythonApplication yapf; + yarn = callPackage ../development/tools/yarn { }; yarn2nix-moretea = callPackage ../development/tools/yarn2nix-moretea/yarn2nix { };