1{ lib, buildPythonPackage, fetchFromGitHub
2, colorama
3, hypothesis
4, poetry-core
5, pylama
6, pytestCheckHook
7}:
8
9let
10in buildPythonPackage rec {
11 pname = "isort";
12 version = "5.6.4";
13 format = "pyproject";
14
15 src = fetchFromGitHub {
16 owner = "PyCQA";
17 repo = "isort";
18 rev = version;
19 sha256 = "1m7jpqssnbsn1ydrw1dn7nrcrggqcvj9v6mk5ampxmvk94xd2r2q";
20 };
21
22 nativeBuildInputs = [
23 poetry-core
24 ];
25
26 checkInputs = [
27 colorama
28 hypothesis
29 pylama
30 pytestCheckHook
31 ];
32
33 postCheck = ''
34 # Confirm that the produced executable script is wrapped correctly and runs
35 # OK, by launching it in a subshell without PYTHONPATH
36 (
37 unset PYTHONPATH
38 echo "Testing that `isort --version-number` returns OK..."
39 $out/bin/isort --version-number
40 )
41 '';
42
43 preCheck = ''
44 HOME=$TMPDIR
45 export PATH=$PATH:$out/bin
46 '';
47
48 pytestFlagsArray = [
49 "--ignore=tests/integration/" # pulls in 10 other packages
50 "--ignore=tests/unit/profiles/test_black.py" # causes infinite recursion to include black
51 ];
52
53 disabledTests = [
54 "test_run" # doesn't like paths in /build
55 "test_pyi_formatting_issue_942"
56 "test_requirements_finder"
57 "test_pipfile_finder"
58 "test_main" # relies on git
59 "test_command_line" # not thread safe
60 "test_encoding_not_in_comment" # not python 3.9 compatible
61 "test_encoding_not_in_first_two_lines" # not python 3.9 compatible
62 "test_requirements_dir" # requires network
63 # plugin not available
64 "test_isort_literals_issue_1358"
65 "test_isort_supports_formatting_plugins_issue_1353"
66 "test_value_assignment_list"
67 # profiles not available
68 "test_isort_supports_shared_profiles_issue_970"
69 ];
70
71 meta = with lib; {
72 description = "A Python utility / library to sort Python imports";
73 homepage = "https://github.com/PyCQA/isort";
74 license = licenses.mit;
75 maintainers = with maintainers; [ couchemar ];
76 };
77}