Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
592 lines (548 loc) · 19.3 KB
/
Copy pathpyproject.toml
File metadata and controls
592 lines (548 loc) · 19.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
# This pyproject.toml defines the uv workspace for Python development.
#
# Pixi (pixi.toml) manages build tools, while uv uses this file to manage
# Python runtime dependencies in a .venv directory. The two work together:
#
# pixi run py-build # Uses maturin to build rerun-sdk into .venv
# pixi run uv run … # Runs Python scripts using .venv
#
# Workspace members (rerun_py, rerun_notebook, examples) are defined in
# [tool.uv.workspace] below.
[project]
name = "rerun-workspace"
version = "0.28.0-alpha.1+dev"
description = "Rerun Python workspace"
requires-python = ">=3.11.5,<3.13"
[dependency-groups]
dev = [
# NOTE: we leave `rerun-sdk` and `rerun-notebook` out of the basic dev dependency list.
# This is because they can be slow to build in a clean environment and it's useful to
# be able to run tools like linting, etc. without having built all the bindings.
#
# This fixup package points the `rerun` CLI of editable installs at `target/debug/rerun`.
"rerun-dev-fixup",
"opentelemetry-exporter-otlp-proto-grpc>=1.45.1",
"maturin>=1.14.1",
"ruff==0.16.9",
"mypy==1.19.1",
# Packages needed for running scripts + their type stubs for mypy
"pandas>=2.0",
"pandas-stubs==2.3.3.251201",
"requests>=2.28",
"types-requests==2.32.4.20250913",
"tqdm>=4.60",
"ty==0.0.84",
"types-tqdm==4.67.0.20250809",
"colorama>=0.4",
"types-colorama>=0.4.15",
"Pillow>=13.0.0,<14", # has py.typed, no stubs needed
"types-psutil>=7.0", # Stubs for `psutil`, used by `rerun.tracing_session()`.
# Typed packages needed for linting scripts/examples
"attrs>=23.1.0",
"semver>=3.0,<3.1",
"tomli>=2.0",
"tomlkit>=0.12",
"GitPython>=3.1",
"PyGithub>=2.0", #NOLINT
"Jinja2>=3.1",
"rich>=13.0",
# Testing packages (typed, needed for linting tests)
"pytest>=8.0",
"pytest-benchmark",
"inline-snapshot>=0.31",
"syrupy>=4.0",
# Notebook dependencies (needed for linting rerun_notebook)
"anywidget>=0.9",
"jupyter-ui-poll>=0.2",
"ipywidgets>=8.0",
# Example dependencies (needed for linting examples)
"platformdirs>=4.0",
# Script dependencies (needed for linting scripts)
"google-cloud-storage>=2.9.0",
"google-cloud-compute>=1.20.0",
"pyyaml>=6.0",
"types-pyyaml>=6.0",
"wheel>=0.46",
# Needed by lerobot importer example. `<1.0` held `transformers` on 4.x, which is why the
# bound is now `<2.0` — `snapshot_download`, the only API we call, is unchanged in 1.x.
"huggingface-hub<2.0",
# Typed packages for dataframe/arrow operations (needed for linting examples/tests)
"polars>=1.0",
"datafusion>=54.0",
"jupyter>=1.0",
# >=2.20.0 fixes the nbconvert stored-XSS (missing CSP sandbox directive).
# >=2.21.1 serves static files with tornado>=6.5.9 (older versions return 500s).
"jupyter-server>=2.21.1",
# Runs the marimo example notebooks in `scripts/ci/run_example_notebooks.py`
"marimo>=0.25.0",
# Needed for pretty-printing tables in `fetch_patch_candidates.py`
"tabulate>=0.9.0",
"types-tabulate>=0.9.0",
]
snippets = ["rerun-sdk[dataloader]", "av", "pandas"]
examples = [
# External deps used by examples
"polars>=0.12.0",
"opencv-python>=4.6",
"segment-anything @ git+https://github.com/facebookresearch/segment-anything.git",
"torch>=2.5.1", # require at least 2.5.1 for some examples
"torchvision>=0.20.1", # require at least 0.20.1 for some examples
# lerobot (used by the dataloader example) is not listed here because it
# requires Python >=3.12 while this workspace supports 3.10+. The dataloader
# is an isolated uv project — sync it from its own directory.
# Example packages from workspace
"air_traffic_data",
"animated_urdf",
"any_scalar",
"arkit_scenes",
"blueprint",
"blueprint_stocks",
"camera_video_stream",
"clock",
"controlnet",
"dataframe_query",
"detect_and_track_objects",
"dicom_mri",
"dna",
"drone_lidar",
"graph_lattice",
"graphs",
"imu_signals",
"incremental_logging",
"lidar",
"live_camera_edge_detection",
"live_scrolling_plot",
"llm_embedding_ner",
"log_file",
"minimal",
"minimal_options",
"multiprocess_logging",
"multithreading",
"nuscenes_dataset",
"nv12",
"objectron",
"open_photogrammetry_format",
"openstreetmap_data",
"plots",
"query_gcs_auth",
"raw_mesh",
"rgbd",
"robot_data_preprocessing",
"rrt_star",
"segment_anything_model",
"server_tables",
"shared_recording",
"stdio",
"structure_from_motion",
"using_index_values",
# TODO(RR-3223): fix opentelemetry conflicts
# "face_tracking",
# "gesture_detection",
# "human_pose_tracking",
]
docs = [
# Documentation build dependencies (mkdocs and plugins)
"griffe>=1.14,<2",
"griffe-public-redundant-aliases==0.3.0",
"griffe-warnings-deprecated==1.1.0",
"mkdocs==1.6.1",
"mkdocs-gen-files==0.5.0",
"mkdocs-literate-nav==0.6.1",
"mkdocs-redirects==1.2.2",
# 9.7.0 relaxed `pymdown-extensions~=10.2` to `>=10.2`, which is what lets us take 11.x below.
"mkdocs-material==9.7.7",
"mkdocs-material-extensions==1.3",
"mkdocstrings>=0.28.2,<0.29",
"mkdocstrings-python>=1.16.2,<2",
"pygments",
"setuptools>75",
"sphobjinv==2.3.1",
]
[tool.uv]
package = false
# pyarrow 24.0.0 ships an incomplete `py.typed` that breaks mypy on `pyarrow.compute.*`.
# 23.x has no type stubs (so mypy leaves it untyped) and clears RUSTSEC/GHSA pyarrow alert >= 23.0.1.
#
# `pymdown-extensions` is transitive (mkdocs-material, mkdocstrings); pinned only to hold a security floor.
constraint-dependencies = ["pyarrow>=23.0.1,<24", "pymdown-extensions>=11.0.0"]
[tool.uv.sources]
rerun-sdk = { workspace = true }
rerun-notebook = { workspace = true }
rerun-dev-fixup = { path = "rerun_py/rerun_dev_fixup", editable = false }
# Example packages
air_traffic_data = { workspace = true }
animated_urdf = { workspace = true }
any_scalar = { workspace = true }
arkit_scenes = { workspace = true }
blueprint = { workspace = true }
blueprint_stocks = { workspace = true }
camera_video_stream = { workspace = true }
clock = { workspace = true }
controlnet = { workspace = true }
dataframe_query = { workspace = true }
detect_and_track_objects = { workspace = true }
dicom_mri = { workspace = true }
dna = { workspace = true }
drone_lidar = { workspace = true }
# face_tracking = { workspace = true }
# gesture_detection = { workspace = true }
graph_lattice = { workspace = true }
graphs = { workspace = true }
# human_pose_tracking = { workspace = true }
imu_signals = { workspace = true }
incremental_logging = { workspace = true }
lidar = { workspace = true }
live_camera_edge_detection = { workspace = true }
live_scrolling_plot = { workspace = true }
llm_embedding_ner = { workspace = true }
log_file = { workspace = true }
minimal = { workspace = true }
minimal_options = { workspace = true }
multiprocess_logging = { workspace = true }
multithreading = { workspace = true }
nuscenes_dataset = { workspace = true }
nv12 = { workspace = true }
objectron = { workspace = true }
open_photogrammetry_format = { workspace = true }
openstreetmap_data = { workspace = true }
# TODO(RR-3548): Figure out a way to include this, without lerobot causing dependency issues.
# dataloader = { workspace = true } # Excluded: lerobot requires Python >=3.12.
plots = { workspace = true }
query_gcs_auth = { workspace = true }
raw_mesh = { workspace = true }
rgbd = { workspace = true }
robot_data_preprocessing = { workspace = true }
rrt_star = { workspace = true }
segment_anything_model = { workspace = true }
server_tables = { workspace = true }
shared_recording = { workspace = true }
state_timeline = { workspace = true }
stdio = { workspace = true }
structure_from_motion = { workspace = true }
using_index_values = { workspace = true }
[tool.uv.workspace]
members = [
"rerun_py",
"rerun_notebook",
# Examples
"examples/python/air_traffic_data",
"examples/python/animated_urdf",
"examples/python/any_scalar",
"examples/python/arkit_scenes",
"examples/python/blueprint_stocks",
"examples/python/blueprint",
"examples/python/camera_video_stream",
"examples/python/clock",
"examples/python/controlnet",
"examples/python/dataframe_query",
"examples/python/detect_and_track_objects",
"examples/python/dicom_mri",
"examples/python/dna",
"examples/python/drone_lidar",
# "examples/python/face_tracking",
# "examples/python/gesture_detection",
"examples/python/graph_lattice",
"examples/python/graphs",
"examples/python/table_grid_with_flags",
# "examples/python/human_pose_tracking",
"examples/python/imu_signals",
"examples/python/incremental_logging",
"examples/python/lidar",
"examples/python/live_camera_edge_detection",
# "examples/python/live_depth_sensor", # Excluded: requires Python <3.11
"examples/python/live_scrolling_plot",
"examples/python/llm_embedding_ner",
"examples/python/log_file",
"examples/python/minimal",
"examples/python/minimal_options",
"examples/python/multiprocess_logging",
"examples/python/multithreading",
"examples/python/nuscenes_dataset",
"examples/python/nv12",
"examples/python/objectron",
# "examples/python/ocr", # Excluded: paddleclas has incompatible opencv requirements
"examples/python/open_photogrammetry_format",
"examples/python/openstreetmap_data",
# "examples/python/dataloader" # Excluded: RR-3548 (lerobot requires Python >=3.12).
"examples/python/plots",
"examples/python/query_gcs_auth",
"examples/python/raw_mesh",
"examples/python/rgbd",
"examples/python/robot_data_preprocessing",
"examples/python/rrt_star",
"examples/python/segment_anything_model",
"examples/python/server_tables",
"examples/python/shared_recording",
"examples/python/state_timeline",
"examples/python/stdio",
"examples/python/structure_from_motion",
"examples/python/table_blueprints",
"examples/python/table_zoo",
"examples/python/template",
"examples/python/using_index_values",
]
[tool.ruff]
line-length = 120
preview = true
src = ["rerun_py", "rerun_py/rerun_sdk", "rerun_notebook"]
extend-exclude = [
"crates",
"target",
".venv",
# Automatically generated test artifacts
"target_ra/",
"target_wasm/",
"target/",
"venv/",
"scripts/ci/compare_path_digest.py",
# Intentionally uses ''' instead of """ so we can embed it in a docstring in the Python API docs.
"docs/snippets/all/archetypes/text_document.py",
"docs/snippets/all/views/text_document.py",
# TODO(#4047): incomplete example snippet
"docs/snippets/all/tutorials/timelines_example.py",
# Intentionally incomplete snippets
"docs/snippets/all/concepts/how_helix_was_logged.py",
"docs/snippets/all/concepts/static",
"docs/snippets/all/tutorials/custom-application-id.py",
"docs/snippets/all/tutorials/custom-recording-id.py",
# generated
"examples/python/objectron/objectron/proto/objectron/proto.py",
# Copied from https://github.com/colmap/colmap/blob/bf3e19140f491c3042bfd85b7192ef7d249808ec/scripts/python/read_write_model.py
"examples/python/structure_from_motion/structure_from_motion/read_write_model.py",
]
[tool.ruff.lint]
extend-select = [
"ANN", # Require type annotations
"S", # flake8-bandit: security lints
]
ignore = [
# flake8-bandit (`S`). This tree is an SDK plus its examples, docs snippets, tests and
# build scripts, so the rules below cannot produce a security finding anywhere in it.
# Everything scoped to a subdirectory instead is under `per-file-ignores`.
"S101", # `assert` — 2,011 of the 2,236 raw findings, nearly all in tests
"S311", # Non-cryptographic random; nothing here generates secrets
"S404", # Flags importing `subprocess` at all
"S603", # Every `subprocess` call whose arguments are not a literal list
"S606", # Starting a process without a shell
"S607", # Running `git`, `cargo`, `curl` etc. from `PATH`, which is deliberate
"S105", # Matches identifier *names*, not values
"S106", # Same, for keyword arguments — both hits are `token="alpha"` in a version bump
# Rules that became active with the ruff upgrade to 0.15:
# TODO(emilk): enable more of these
"B005", # Using `.strip()` with multi-character strings
"BLE001", # Do not catch blind exception: `Exception`
"DTZ001", # `datetime.datetime()` called without a `tzinfo` argument
"DTZ002", # `datetime.datetime.today()` used
"DTZ005", # `datetime.datetime.now()` called without a `tz` argument
"DTZ006", # `datetime.fromtimestamp()` called without a `tz` argument
"DTZ007", # `datetime.strptime()` without `%z`
"LOG015", # Root logger call
"PLR1704", # Redefining argument with the local name
"PLW0602", # Using global for variable that is not assigned
"PLW1510", # `subprocess.run` without explicit `check` argument
"RUF012", # Mutable class variables should be annotated with `typing.ClassVar`
"S110", # `try`-`except`-`pass` detected
"SIM102", # Use a single `if` statement instead of nested `if` statements
"SIM115", # Use context handler for opening files
"TRY002", # Create your own exception
"TRY004", # Prefer `TypeError` exception for invalid type
# Rules that became active with the ruff upgrade to 0.16:
"RUF069", # Exact float equality comparison
]
[tool.ruff.lint.flake8-annotations]
mypy-init-return = true
# `*args: Any, **kwargs: Any` forwards arguments to a callee that checks their types.
allow-star-arg-any = true
[tool.ruff.lint.per-file-ignores]
"docs/snippets/all/*" = [
# Missing required import: `from __future__ import annotations`
"I002",
# A fixed `/tmp` path, shown for brevity in a documentation snippet:
"S108",
]
"docs/snippets/all/views/tensor.py" = [
# Its output must match the backwards-compatibility asset in `tests/assets/rrd/snippets/`, recorded with the legacy RNG.
"NPY002",
]
"crates/top/re_viewer/data/quick_start_guides/*" = [
# Missing required import: `from __future__ import annotations`
"I002",
]
"tests/python/*" = [
# We don't care about nice APIs in our tests:
"PLR0917",
"ANN401", # Explicit `Any`
]
"examples/notebook/*/*_marimo.py" = [
# marimo's notebook format: a cell's last expression is its output, and every cell ends in `return`.
"B018",
"PLR1711",
# marimo injects cell arguments by name from other cells' return values.
"ANN",
]
"examples/notebook/notebook_neural_field_2d/neural_field_2d.ipynb" = [
# Intentional use of `σ`
"RUF001",
]
"examples/*" = [
# We don't care about nice APIs in our examples:
"PLR0917",
# Demos that fetch public datasets and serve locally. Not a security surface,
# and each of these would make the example noisier without making it safer:
"S113", # `requests` without a timeout
"S108", # fixed `/tmp` paths
"S104", # binding all interfaces
]
"scripts/*" = [
# We don't care about nice APIs in our scripts:
"PLR0917",
"ANN401", # Explicit `Any`
# Build tooling that runs on inputs we control:
"S314", # parsing SVG that `d2` just produced
"S405", # importing `xml.etree` to do it
"S605", # `os.popen` on a `cargo tree` pipeline built from our own CLI args
]
######################
# mypy configuration #
######################
[tool.mypy]
# Force mypy to check against the stdlib of our minimum supported Python, even if pixi runs a newer one.
python_version = "3.11"
# Examples and docs are managed independently of the SDK.
# in ini file adjacent to this.
files = [
"rerun_py/rerun_sdk/rerun",
"rerun_py/rerun_sdk/rerun_bindings",
"rerun_py/tests",
"rerun_notebook/src/rerun_notebook",
"tests/python",
]
# These paths allow mypy to find rerun and rerun_bindings without needing
# to run maturin develop first (which installs the .pth file).
mypy_path = ["rerun_py", "rerun_py/rerun_sdk"]
namespace_packages = true
show_error_codes = true
strict = true
enable_error_code = ["redundant-expr", "truthy-bool", "ignore-without-code", "possibly-undefined"]
ignore_missing_imports = false
no_implicit_reexport = false
disallow_untyped_calls = false
[[tool.mypy.overrides]]
module = [
"pyarrow.*",
# https://github.com/jupyter-widgets/ipywidgets/issues/3688
"ipywidgets.*",
"anywidget.*",
# TODO(nick): is this blocked on above?
"jupyter_ui_poll.*",
# Optional: only imported when running inside a marimo kernel.
"marimo.*",
# Ignore imports used in tests but not in the SDK.
"torch.*",
"torchvision.*",
"torchaudio.*",
"cv2.*",
"huggingface_hub.*",
]
ignore_missing_imports = true
[tool.ty.environment]
extra-paths = [
"rerun_py",
"rerun_py/rerun_sdk",
"rerun_notebook/src",
# Scripts that import siblings by putting their own directory on `sys.path`.
"scripts",
"scripts/ci",
]
[tool.ty.src]
include = [
"crates",
"docs",
"examples",
"rerun_notebook",
"rerun_pixi_env",
"rerun_py",
"scripts",
"skills",
"tests",
]
exclude = [
# Isolated examples have their own environment; see `py-lint-isolated-examples`.
"examples/python/dataloader",
"examples/python/droid_semantic_search",
]
[tool.ty.analysis]
# Not in the shared `.venv`: optional dependencies of individual examples and tools,
# and hardware or ROS SDKs that need a system install.
allowed-unresolved-imports = [
"cv_bridge",
"frontmatter",
"gitignore_parser",
"griffe.**",
"image_geometry",
"lancedb.**",
"laser_geometry",
"lerobot.**",
"mediapipe.**",
"mkdocs_gen_files.**",
"nav_msgs.**",
"paddleocr.**",
"pdf2image",
"pyrealsense2",
"rclpy.**",
"rerun_lerobot.**",
"sensor_msgs.**",
"sensor_msgs_py",
"std_msgs.**",
"tf2_msgs.**",
]
[tool.ty.rules]
# - invalid-argument-type: tests that pass values typed `object`, and numpy and pyarrow stubs that are
# narrower than what we pass at runtime.
# - unresolved-attribute: largely `pyarrow.compute`, whose functions are created at runtime.
# TODO(emilk): burn down.
invalid-argument-type = "ignore"
unresolved-attribute = "ignore"
[[tool.ty.overrides]]
include = ["scripts/ci/crates.py", "scripts/ci/update_rerun_notebook_version.py"]
[tool.ty.overrides.rules]
# `tomlkit` types every value it reads as `Item | Container`, which cannot be indexed, iterated or assigned to.
invalid-assignment = "ignore"
not-iterable = "ignore"
not-subscriptable = "ignore"
[[tool.ty.overrides]]
include = ["rerun_py/tests/test_types/**"]
[tool.ty.overrides.rules]
# Generated code: some types need the suppressions the generator emits, others do not.
unused-ignore-comment = "ignore"
[[tool.ty.overrides]]
# Fragments that are shown in the docs but not runnable on their own, so they use names they never define.
include = [
"docs/snippets/all/concepts/how_helix_was_logged.py",
"docs/snippets/all/concepts/static/log_static.py",
"docs/snippets/all/concepts/static/log_static_10x.py",
"docs/snippets/all/concepts/static/log_temporal_10x.py",
"docs/snippets/all/concepts/static/send_static.py",
"docs/snippets/all/tutorials/custom-application-id.py",
"docs/snippets/all/tutorials/custom-recording-id.py",
"docs/snippets/all/tutorials/timelines_example.py",
]
[tool.ty.overrides.rules]
unresolved-reference = "ignore"
[[tool.ty.overrides]]
# `rerun/tests/__init__.py` makes `tests` a regular package, which hides `rerun_py/tests` from
# ty, so the relative imports in there do not resolve.
include = ["rerun_py/tests/**"]
[tool.ty.overrides.rules]
unresolved-import = "ignore"
[[tool.ty.overrides]]
# ty is the only type checker that sees notebooks, so restore the rules ignored workspace-wide above.
include = ["examples/notebook/**"]
[tool.ty.overrides.rules]
invalid-argument-type = "error"
unresolved-attribute = "error"
[[tool.ty.overrides]]
include = ["rerun_py/rerun_sdk/rerun/encodings/class_description.py"]
[tool.ty.overrides.rules]
# The generated keypoint fields are typed as lists, but hold `None` when not given.
invalid-assignment = "ignore"