1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonOlder,
6 diff-cover,
7 graphviz,
8 hatchling,
9 hatch-vcs,
10 packaging,
11 pytest-mock,
12 pytestCheckHook,
13 pip,
14 virtualenv,
15}:
16
17buildPythonPackage rec {
18 pname = "pipdeptree";
19 version = "2.28.0";
20 pyproject = true;
21
22 disabled = pythonOlder "3.8";
23
24 src = fetchFromGitHub {
25 owner = "tox-dev";
26 repo = "pipdeptree";
27 tag = version;
28 hash = "sha256-PYlNMAomqN9T60b8bRqb8mnLjFRn3JnI79Tynncxje8=";
29 };
30
31 postPatch = ''
32 # only set to ensure py3.13 compat
33 # https://github.com/tox-dev/pipdeptree/pull/406
34 substituteInPlace pyproject.toml \
35 --replace-fail '"pip>=24.2"' '"pip"'
36 '';
37
38 build-system = [
39 hatchling
40 hatch-vcs
41 ];
42
43 dependencies = [
44 pip
45 packaging
46 ];
47
48 optional-dependencies = {
49 graphviz = [ graphviz ];
50 };
51
52 nativeCheckInputs = [
53 diff-cover
54 pytest-mock
55 pytestCheckHook
56 virtualenv
57 ]
58 ++ lib.flatten (builtins.attrValues optional-dependencies);
59
60 pythonImportsCheck = [ "pipdeptree" ];
61
62 disabledTests = [
63 # Don't run console tests
64 "test_console"
65 ];
66
67 meta = with lib; {
68 description = "Command line utility to show dependency tree of packages";
69 homepage = "https://github.com/tox-dev/pipdeptree";
70 changelog = "https://github.com/tox-dev/pipdeptree/releases/tag/${src.tag}";
71 license = licenses.mit;
72 maintainers = with maintainers; [
73 charlesbaynham
74 mdaniels5757
75 ];
76 mainProgram = "pipdeptree";
77 };
78}