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