nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 pkgs,
5 buildPythonPackage,
6 rerun,
7 python,
8
9 # nativeBuildInputs
10 rustPlatform,
11
12 # dependencies
13 attrs,
14 numpy,
15 opencv4,
16 pillow,
17 pyarrow,
18 semver,
19 typing-extensions,
20
21 # tests
22 datafusion,
23 inline-snapshot,
24 polars,
25 pytest-snapshot,
26 pytestCheckHook,
27 tomli,
28 torch,
29}:
30
31buildPythonPackage {
32 pname = "rerun-sdk";
33 pyproject = true;
34
35 inherit (rerun)
36 src
37 version
38 cargoDeps
39 ;
40
41 postPatch =
42 (rerun.postPatch or "")
43
44 # error: failed to parse contents of PYO3_CONFIG_FILE
45 #
46 # The pyo3 config file is supposed to be generated beforehand by invoking pixi.
47 # As the only goal of this file is to enhance build caching, it is not worth bothering with it.
48 # See https://github.com/rerun-io/rerun/blob/0.29.0/BUILD.md#pythonpyo3-configuration-important
49 + ''
50 substituteInPlace .cargo/config.toml \
51 --replace-fail \
52 "PYO3_CONFIG_FILE" \
53 "# PYO3_CONFIG_FILE"
54 '';
55
56 nativeBuildInputs = [
57 pkgs.protobuf # for protoc
58 rerun
59 rustPlatform.cargoSetupHook
60 rustPlatform.maturinBuildHook
61 ];
62
63 dependencies = [
64 attrs
65 numpy
66 opencv4
67 pillow
68 pyarrow
69 semver
70 typing-extensions
71 ];
72
73 buildAndTestSubdir = "rerun_py";
74
75 # https://github.com/NixOS/nixpkgs/issues/289340
76 #
77 # Alternatively, one could
78 # dontUsePythonImportsCheck = true;
79 # dontUsePytestCheck = true;
80 postInstall = ''
81 rm $out/${python.sitePackages}/rerun_sdk.pth
82 ln -s rerun_sdk/rerun $out/${python.sitePackages}/rerun
83 '';
84
85 pythonImportsCheck = [ "rerun" ];
86
87 nativeCheckInputs = [
88 datafusion
89 inline-snapshot
90 polars
91 pytest-snapshot
92 pytestCheckHook
93 tomli
94 torch
95 ];
96
97 inherit (rerun) addDlopenRunpaths addDlopenRunpathsPhase;
98 postPhases = lib.optionals stdenv.hostPlatform.isLinux [ "addDlopenRunpathsPhase" ];
99
100 disabledTests = [
101 # ConnectionError: Connection: connecting to server: transport error
102 "test_isolated_streams"
103 "test_send_dataframe_roundtrip"
104 "test_server_with_dataset_files"
105 "test_server_with_dataset_prefix"
106 "test_server_with_multiple_datasets"
107
108 # TypeError: 'Snapshot' object is not callable
109 "test_schema_recording"
110 ];
111
112 disabledTestPaths = [
113 # "fixture 'benchmark' not found"
114 "tests/python/log_benchmark/test_log_benchmark.py"
115
116 # ValueError: Failed to start Rerun server: Error loading RRD: couldn't decode "/build/source/tests/assets/rrd/dataset/file4.rrd"
117 "rerun_py/tests/e2e_redap_tests"
118
119 # ConnectionError: Connection: connecting to server: transport error
120 "rerun_py/tests/api_sandbox/"
121
122 # RuntimeError: Failed to load URDF file: No elements found
123 "rerun_py/tests/unit/test_urdf_tree.py"
124 ];
125
126 __darwinAllowLocalNetworking = true;
127
128 meta = {
129 description = "Python bindings for `rerun` (an interactive visualization tool for stream data)";
130 inherit (rerun.meta)
131 changelog
132 homepage
133 license
134 maintainers
135 ;
136 mainProgram = "rerun";
137 };
138}