-
Notifications
You must be signed in to change notification settings - Fork 829
Expand file tree
/
Copy pathpyproject.toml
More file actions
486 lines (456 loc) · 16.3 KB
/
Copy pathpyproject.toml
File metadata and controls
486 lines (456 loc) · 16.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
# 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.10,<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 installs a .pth file that makes `import rerun` work
# with editable installs by adding rerun_py/rerun_sdk to the Python path.
"rerun-dev-fixup",
"opentelemetry-exporter-otlp-proto-grpc==1.39.0",
"maturin>=1.14.1",
"ruff==0.15.7",
"mypy==1.19.1",
"nbqa==1.9.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.31",
"types-tqdm==4.67.0.20250809",
"colorama>=0.4",
"types-colorama>=0.4.15",
"Pillow>=12.3.0,<13", # 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",
"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)
"jupyter-server>=2.20.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",
"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 }
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/depth_guided_stable_diffusion",
"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/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/huggingface/diffusers/blob/fc9fecc217e58d72c0d5796575c72088251ff4df/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_depth2img.py
"examples/python/depth_guided_stable_diffusion/depth_guided_stable_diffusion/huggingface_pipeline.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 = [
"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
]
[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",
]
"crates/viewer/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",
]
"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",
# 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 3.10 stdlib, even though pixi runs 3.11.
# This catches imports like `from typing import Self` that don't exist in 3.10.
python_version = "3.10"
# Examples and docs are managed independently of the SDK.
# in ini file adjacent to this.
files = [
"rerun_py/rerun_sdk/rerun",
"rerun_py/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.*",
# Ignore imports used in tests but not in the SDK.
"torch.*",
"torchvision.*",
"torchaudio.*",
"cv2.*",
"huggingface_hub.*",
]
ignore_missing_imports = true
[[tool.mypy.overrides]]
# rerun_draft is a sandbox for testing new APIs - we don't care about strict type checking
module = ["api_sandbox.rerun_draft.*", "rerun_draft.*"]
ignore_errors = true
ignore_missing_imports = true
[tool.ty.environment]
extra-paths = ["rerun_py", "rerun_py/rerun_sdk"]
[tool.ty.src]
include = [
"rerun_py/rerun_sdk/rerun",
"rerun_py/rerun_bindings",
"rerun_py/tests",
"rerun_notebook/src/rerun_notebook",
"tests/python",
]
[tool.ty.rules]
# parsing disagrees with mypy
unused-ignore-comment = "ignore"
unused-type-ignore-comment = "ignore"
# Stricter parsing than mypy
invalid-argument-type = "ignore"
# this is our api draft need to figure out that config
unresolved-import = "ignore"
# others to burn down
call-non-callable = "ignore"
# TODO(astral-sh/ty/#2501)
index-out-of-bounds = "ignore"
invalid-assignment = "ignore"
no-matching-overload = "ignore"
unresolved-attribute = "ignore"
unresolved-reference = "ignore"
unsupported-operator = "ignore"