chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 13:05:14 +08:00
commit 2a547be7fe
7904 changed files with 1000926 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
<!--[metadata]
title = "Log file"
tags = ["API example", "Loader"]
thumbnail = "https://static.rerun.io/log_file/d86e525cce547cd2dde8e2d7619c01bd3bbc861a/480w.png"
thumbnail_dimensions = [480, 480]
-->
Demonstrates how to log any file from the SDK using the [`Importer`](https://www.rerun.io/docs/concepts/logging-and-ingestion/importers/overview) machinery.
Usage:
```bash
python examples/python/log_file/log_file.py examples/assets
```
+48
View File
@@ -0,0 +1,48 @@
#!/usr/bin/env python3
"""
Demonstrates how to log any file from the SDK using the `Importer` machinery.
See <https://www.rerun.io/docs/concepts/logging-and-ingestion/importers/overview> for more information.
"""
from __future__ import annotations
import argparse
from pathlib import Path
import rerun as rr # pip install rerun-sdk
def main() -> None:
parser = argparse.ArgumentParser(
description="Demonstrates how to log any file from the SDK using the `Importer` machinery.",
)
rr.script_add_args(parser)
parser.add_argument(
"--from-contents",
action="store_true",
default=False,
help="Log the contents of the file directly (files only -- not supported by external loaders).",
)
parser.add_argument("filepaths", nargs="+", type=Path, help="The filepaths to be loaded and logged.")
args = parser.parse_args()
rr.script_setup(args, "rerun_example_log_file")
for filepath in args.filepaths:
if not args.from_contents:
# Either log the file using its path…
rr.log_file_from_path(filepath, entity_path_prefix="log_file_example")
else:
# …or using its contents if you already have them loaded for some reason.
try:
with open(filepath, "rb") as file:
rr.log_file_from_contents(filepath, file.read(), entity_path_prefix="log_file_example")
except Exception:
pass
rr.script_teardown(args)
if __name__ == "__main__":
main()
+12
View File
@@ -0,0 +1,12 @@
[project]
name = "log_file"
version = "0.1.0"
readme = "README.md"
dependencies = ["rerun-sdk"]
[project.scripts]
log_file = "log_file:main"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"