summary refs log tree commit diff
path: root/pkgs/development/python-modules/diagrams
diff options
context:
space:
mode:
authorNick Bathum <nickbathum@gmail.com>2021-04-10 13:06:35 -0400
committerNick Bathum <nickbathum@gmail.com>2021-04-12 13:24:32 -0400
commit5e5a40b1ee0ccd5f3cd7423dfcf2fb6aad265ca6 (patch)
treec6da77dda627b4acc694d45c858c9c7579e2dcdc /pkgs/development/python-modules/diagrams
parente2d7984d8cae0f9be8ab147f9afc89022b866c27 (diff)
downloadnixpkgs-5e5a40b1ee0ccd5f3cd7423dfcf2fb6aad265ca6.tar
nixpkgs-5e5a40b1ee0ccd5f3cd7423dfcf2fb6aad265ca6.tar.gz
nixpkgs-5e5a40b1ee0ccd5f3cd7423dfcf2fb6aad265ca6.tar.bz2
nixpkgs-5e5a40b1ee0ccd5f3cd7423dfcf2fb6aad265ca6.tar.lz
nixpkgs-5e5a40b1ee0ccd5f3cd7423dfcf2fb6aad265ca6.tar.xz
nixpkgs-5e5a40b1ee0ccd5f3cd7423dfcf2fb6aad265ca6.tar.zst
nixpkgs-5e5a40b1ee0ccd5f3cd7423dfcf2fb6aad265ca6.zip
pythonPackages.diagrams: init at 0.19.1
Add python diagrams library. Generate nice architecture diagrams
with python code, allowing for rapid iteration.

The images are rendered using dot from graphviz.

This PR is based on the upstream GitHub repo for diagrams, which
differs significantly from the tarball published to pypi.

Closes #101532
Diffstat (limited to 'pkgs/development/python-modules/diagrams')
-rw-r--r--pkgs/development/python-modules/diagrams/build_poetry.patch12
-rw-r--r--pkgs/development/python-modules/diagrams/default.nix49
2 files changed, 61 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/diagrams/build_poetry.patch b/pkgs/development/python-modules/diagrams/build_poetry.patch
new file mode 100644
index 00000000000..b2e3d39dae1
--- /dev/null
+++ b/pkgs/development/python-modules/diagrams/build_poetry.patch
@@ -0,0 +1,12 @@
+diff --git a/pyproject.toml b/pyproject.toml
+index 2c93a39..6c800e2 100644
+--- a/pyproject.toml
++++ b/pyproject.toml
+@@ -24,3 +24,7 @@ isort = "^4.3"
+ 
+ [tool.black]
+ line-length = 120
++
++[build-system]
++requires = ["poetry_core>=1.0.0"]
++build-backend = "poetry.core.masonry.api"
diff --git a/pkgs/development/python-modules/diagrams/default.nix b/pkgs/development/python-modules/diagrams/default.nix
new file mode 100644
index 00000000000..37e23d730e6
--- /dev/null
+++ b/pkgs/development/python-modules/diagrams/default.nix
@@ -0,0 +1,49 @@
+{ lib
+, buildPythonPackage
+, pythonOlder
+, fetchFromGitHub
+, black
+, jinja2
+, poetry-core
+, round
+, graphviz
+, inkscape
+, imagemagick
+, pytestCheckHook
+}:
+
+buildPythonPackage rec {
+  pname = "diagrams";
+  version = "0.19.1";
+  format = "pyproject";
+  disabled = pythonOlder "3.6";
+
+  src = fetchFromGitHub {
+    owner = "mingrammer";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "0qvk0cp3026n5jmwp9z7m70b6pws0h6a7slxr23glg18baxr44d4";
+  };
+
+  preConfigure = ''
+    patchShebangs autogen.sh
+    ./autogen.sh
+  '';
+
+  patches = [ ./build_poetry.patch ];
+
+  checkInputs = [ pytestCheckHook ];
+
+  # Despite living in 'tool.poetry.dependencies',
+  # these are only used at build time to process the image resource files
+  nativeBuildInputs = [ black inkscape imagemagick jinja2 poetry-core round ];
+
+  propagatedBuildInputs = [ graphviz ];
+
+  meta = with lib; {
+    description = "Diagram as Code";
+    homepage    = "https://diagrams.mingrammer.com/";
+    license     = licenses.mit;
+    maintainers =  with maintainers; [ addict3d ];
+  };
+}