Unverified Commit 46c1ce89 authored by Gavin John's avatar Gavin John
Browse files

python312Packages.kaleido: Add passthru.tests

parent 534c90d2
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
  stdenv,
  python,
  buildPythonPackage,
  callPackage,
  fetchurl,
  autoPatchelfHook,
  bash,
@@ -96,6 +97,8 @@ buildPythonPackage rec {
    #ln -s ${lato}/share/fonts/lato/* $out/${python.sitePackages}/kaleido/executable/xdg/fonts/truetype/lato/
  '';

  passthru.tests.kaleido = callPackage ./tests.nix { };

  meta = {
    description = "Fast static image export for web-based visualization libraries with zero dependencies";
    homepage = "https://github.com/plotly/Kaleido";
+15 −0
Original line number Diff line number Diff line
{
  runCommand,
  python,
  plotly,
  pandas,
  kaleido,
}:

runCommand "${kaleido.pname}-tests" {
  nativeBuildInputs = [
    python
    plotly
    pandas
  ];
} "python3 ${./tests.py}"
+11 −0
Original line number Diff line number Diff line
import plotly.express as px
import os
import os.path

out = os.environ["out"]
if not os.path.exists(out):
  os.makedirs(out)

outfile = os.path.join(out, "figure.png")
fig = px.scatter(px.data.iris(), x="sepal_length", y="sepal_width", color="species")
fig.write_image(outfile, engine="kaleido")