1{ lib, buildPythonPackage, fetchPypi, isPy27, futures, backports_functools_lru_cache, mock, pytest }:
2
3let
4 skipTests = [ "test_requirements_finder" "test_pipfile_finder" ] ++ lib.optional isPy27 "test_standard_library_deprecates_user_issue_778";
5 testOpts = lib.concatMapStringsSep " " (t: "--deselect test_isort.py::${t}") skipTests;
6in buildPythonPackage rec {
7 pname = "isort";
8 version = "4.3.20"; # Note 4.x is the last version that supports Python2
9
10 src = fetchPypi {
11 inherit pname version;
12 sha256 = "c40744b6bc5162bbb39c1257fe298b7a393861d50978b565f3ccd9cb9de0182a";
13 };
14
15 propagatedBuildInputs = lib.optionals isPy27 [ futures backports_functools_lru_cache ];
16
17 checkInputs = [ mock pytest ];
18
19 # isort excludes paths that contain /build/, so test fixtures don't work with TMPDIR=/build/
20 checkPhase = ''
21 PATH=$out/bin:$PATH TMPDIR=/tmp/ pytest ${testOpts}
22 '';
23
24 meta = with lib; {
25 description = "A Python utility / library to sort Python imports";
26 homepage = https://github.com/timothycrosley/isort;
27 license = licenses.mit;
28 maintainers = with maintainers; [ couchemar nand0p ];
29 };
30}