1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch,
6 graphviz,
7 imagemagick,
8 inkscape,
9 jinja2,
10 poetry-core,
11 pytestCheckHook,
12 pythonOlder,
13 round,
14}:
15
16buildPythonPackage rec {
17 pname = "diagrams";
18 version = "0.24.4";
19 pyproject = true;
20
21 disabled = pythonOlder "3.9";
22
23 src = fetchFromGitHub {
24 owner = "mingrammer";
25 repo = "diagrams";
26 tag = "v${version}";
27 hash = "sha256-N4JGrtgLgGUayFR6/xTf3GZEZjtxC/4De3ZCfRZbi6M=";
28 };
29
30 patches = [
31 # Add build-system, https://github.com/mingrammer/diagrams/pull/1089
32 (fetchpatch {
33 name = "add-build-system.patch";
34 url = "https://github.com/mingrammer/diagrams/commit/59b84698b142f5a0998ee9e395df717a1b77e9b2.patch";
35 hash = "sha256-/zV5X4qgHJs+KO9gHyu6LqQ3hB8Zx+BzOFo7K1vQK78=";
36 })
37 ./remove-black-requirement.patch
38 ];
39
40 pythonRemoveDeps = [ "pre-commit" ];
41
42 pythonRelaxDeps = [ "graphviz" ];
43
44 preConfigure = ''
45 patchShebangs autogen.sh
46 ./autogen.sh
47 '';
48
49 build-system = [ poetry-core ];
50
51 # Despite living in 'tool.poetry.dependencies',
52 # these are only used at build time to process the image resource files
53 nativeBuildInputs = [
54 inkscape
55 imagemagick
56 jinja2
57 round
58 ];
59
60 dependencies = [ graphviz ];
61
62 nativeCheckInputs = [ pytestCheckHook ];
63
64 pythonImportsCheck = [ "diagrams" ];
65
66 meta = with lib; {
67 description = "Diagram as Code";
68 homepage = "https://diagrams.mingrammer.com/";
69 changelog = "https://github.com/mingrammer/diagrams/releases/tag/${src.tag}";
70 license = licenses.mit;
71 maintainers = with maintainers; [ addict3d ];
72 };
73}