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