Skip to content

Commit 46c1ce8

Browse files
committed
python312Packages.kaleido: Add passthru.tests
1 parent 534c90d commit 46c1ce8

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

pkgs/development/python-modules/kaleido/default.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
stdenv,
44
python,
55
buildPythonPackage,
6+
callPackage,
67
fetchurl,
78
autoPatchelfHook,
89
bash,
@@ -96,6 +97,8 @@ buildPythonPackage rec {
9697
#ln -s ${lato}/share/fonts/lato/* $out/${python.sitePackages}/kaleido/executable/xdg/fonts/truetype/lato/
9798
'';
9899

100+
passthru.tests.kaleido = callPackage ./tests.nix { };
101+
99102
meta = {
100103
description = "Fast static image export for web-based visualization libraries with zero dependencies";
101104
homepage = "https://github.com/plotly/Kaleido";
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
runCommand,
3+
python,
4+
plotly,
5+
pandas,
6+
kaleido,
7+
}:
8+
9+
runCommand "${kaleido.pname}-tests" {
10+
nativeBuildInputs = [
11+
python
12+
plotly
13+
pandas
14+
];
15+
} "python3 ${./tests.py}"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import plotly.express as px
2+
import os
3+
import os.path
4+
5+
out = os.environ["out"]
6+
if not os.path.exists(out):
7+
os.makedirs(out)
8+
9+
outfile = os.path.join(out, "figure.png")
10+
fig = px.scatter(px.data.iris(), x="sepal_length", y="sepal_width", color="species")
11+
fig.write_image(outfile, engine="kaleido")

0 commit comments

Comments
 (0)