about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/isort/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/isort/default.nix')
-rw-r--r--nixpkgs/pkgs/development/python-modules/isort/default.nix30
1 files changed, 30 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/isort/default.nix b/nixpkgs/pkgs/development/python-modules/isort/default.nix
new file mode 100644
index 000000000000..bb9958a6fef1
--- /dev/null
+++ b/nixpkgs/pkgs/development/python-modules/isort/default.nix
@@ -0,0 +1,30 @@
+{ lib, buildPythonPackage, fetchPypi, isPy27, futures, backports_functools_lru_cache, mock, pytest }:
+
+let
+  skipTests = lib.optional isPy27 "test_standard_library_deprecates_user_issue_778";
+  testOpts = lib.concatMapStringsSep " " (t: "--deselect test_isort.py::${t}") skipTests;
+in buildPythonPackage rec {
+  pname = "isort";
+  version = "4.3.16"; # Note 4.x is the last version that supports Python2
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "1v6lapqhc33rxr9698lqjyb49fis27i42p3ymngrw95py3qf7y08";
+  };
+
+  propagatedBuildInputs = lib.optionals isPy27 [ futures backports_functools_lru_cache ];
+
+  checkInputs = [ mock pytest ];
+
+  # isort excludes paths that contain /build/, so test fixtures don't work with TMPDIR=/build/
+  checkPhase = ''
+    PATH=$out/bin:$PATH TMPDIR=/tmp/ pytest ${testOpts}
+  '';
+
+  meta = with lib; {
+    description = "A Python utility / library to sort Python imports";
+    homepage = https://github.com/timothycrosley/isort;
+    license = licenses.mit;
+    maintainers = with maintainers; [ couchemar nand0p ];
+  };
+}