1{
2 buildPythonPackage,
3 lib,
4 rustPlatform,
5 stdenv,
6 attrs,
7 darwin,
8 numpy,
9 pillow,
10 pyarrow,
11 rerun,
12 torch,
13 typing-extensions,
14 pytestCheckHook,
15 python,
16 libiconv,
17}:
18
19buildPythonPackage {
20 pname = "rerun-sdk";
21 inherit (rerun) version;
22 pyproject = true;
23
24 inherit (rerun) src;
25 inherit (rerun) cargoDeps;
26
27 nativeBuildInputs = [
28 rustPlatform.cargoSetupHook
29 rustPlatform.maturinBuildHook
30 ];
31
32 buildInputs =
33 [
34 libiconv # No-op on Linux, necessary on Darwin.
35 ]
36 ++ lib.optionals stdenv.hostPlatform.isDarwin [
37 darwin.apple_sdk.frameworks.AppKit
38 darwin.apple_sdk.frameworks.CoreServices
39 ];
40
41 propagatedBuildInputs = [
42 attrs
43 numpy
44 pillow
45 pyarrow
46 typing-extensions
47 ];
48
49 buildAndTestSubdir = "rerun_py";
50
51 # https://github.com/NixOS/nixpkgs/issues/289340
52 #
53 # Alternatively, one could
54 # dontUsePythonImportsCheck = true;
55 # dontUsePytestCheck = true;
56 postInstall = ''
57 rm $out/${python.sitePackages}/rerun_sdk.pth
58 ln -s rerun_sdk/rerun $out/${python.sitePackages}/rerun
59 '';
60
61 pythonImportsCheck = [ "rerun" ];
62
63 nativeCheckInputs = [
64 pytestCheckHook
65 torch
66 ];
67
68 inherit (rerun) addDlopenRunpaths addDlopenRunpathsPhase;
69 postPhases = lib.optionals stdenv.isLinux [ "addDlopenRunpathsPhase" ];
70
71 disabledTestPaths = [
72 # "fixture 'benchmark' not found"
73 "tests/python/log_benchmark/test_log_benchmark.py"
74 ];
75
76 meta = {
77 description = "Python bindings for `rerun` (an interactive visualization tool for stream data)";
78 inherit (rerun.meta)
79 changelog
80 homepage
81 license
82 maintainers
83 ;
84 mainProgram = "rerun";
85 };
86}