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