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