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