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.26.1";
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-mgmUIN49zLo5XYWW5Y9XXeZ9RurB1LekF3/vl8EDhxM=";
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 ] ++ lib.flatten (builtins.attrValues optional-dependencies);
58
59 pythonImportsCheck = [ "pipdeptree" ];
60
61 disabledTests = [
62 # Don't run console tests
63 "test_console"
64 ];
65
66 meta = with lib; {
67 description = "Command line utility to show dependency tree of packages";
68 homepage = "https://github.com/tox-dev/pipdeptree";
69 changelog = "https://github.com/tox-dev/pipdeptree/releases/tag/${src.tag}";
70 license = licenses.mit;
71 maintainers = with maintainers; [ charlesbaynham ];
72 mainProgram = "pipdeptree";
73 };
74}