1{ lib, buildPythonPackage, fetchFromGitHub
2, colorama
3, hypothesis
4, poetry-core
5, pylama
6, pytestCheckHook
7}:
8
9buildPythonPackage rec {
10 pname = "isort";
11 version = "5.9.3";
12 format = "pyproject";
13
14 src = fetchFromGitHub {
15 owner = "PyCQA";
16 repo = "isort";
17 rev = version;
18 sha256 = "sha256-JbRZ/3Xz35tGoCNnQesR08Sjoz3yimxZyxhhOXGvmXw=";
19 };
20
21 nativeBuildInputs = [
22 poetry-core
23 ];
24
25 checkInputs = [
26 colorama
27 hypothesis
28 pylama
29 pytestCheckHook
30 ];
31
32 postCheck = ''
33 # Confirm that the produced executable script is wrapped correctly and runs
34 # OK, by launching it in a subshell without PYTHONPATH
35 (
36 unset PYTHONPATH
37 echo "Testing that `isort --version-number` returns OK..."
38 $out/bin/isort --version-number
39 )
40 '';
41
42 preCheck = ''
43 HOME=$TMPDIR
44 export PATH=$PATH:$out/bin
45 '';
46
47 pytestFlagsArray = [
48 "--ignore=tests/benchmark/" # requires pytest-benchmark
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_sort_configurable_sort_issue_1732"
67 "test_value_assignment_list"
68 # profiles not available
69 "test_isort_supports_shared_profiles_issue_970"
70 ];
71
72 meta = with lib; {
73 description = "A Python utility / library to sort Python imports";
74 homepage = "https://github.com/PyCQA/isort";
75 license = licenses.mit;
76 maintainers = with maintainers; [ couchemar ];
77 };
78}