-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DataLoader
s 2: add text-based DataLoader
(.txt
, .md
)
#4518
Conversation
DataLoader
s 3: add text-based DataLoader
(.txt
, .md
)DataLoader
s 2: add text-based DataLoader
(.txt
, .md
)
a035d19
to
c830876
Compare
3b58604
to
7b1b30a
Compare
f4c4781
to
b0a47fe
Compare
7b1b30a
to
21a7fe2
Compare
I forgot to update the |
@@ -49,8 +45,11 @@ pub const SUPPORTED_MESH_EXTENSIONS: &[&str] = &["glb", "gltf", "obj"]; | |||
|
|||
pub const SUPPORTED_RERUN_EXTENSIONS: &[&str] = &["rrd"]; | |||
|
|||
pub const SUPPORTED_TEXT_EXTENSIONS: &[&str] = &["txt", "md"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should support .rs
, .yaml
, .json
, … etc too. Anything with the text
mediatype basically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm... I'd rather not list every single language-specific file extension in existence, and we'd get very little value out of it: our rendering of plain text is pretty dull and non-interactive.
Same thing with structured formats (toml, json...), if we cannot make use of their structure, there's very little value in having opening them in plain-text, and I'd rather not list them all...
I think I'll open an issue to introduce a builtin catch-all DataLoader
that accepts all things of this nature and logs them as markdown with the proper syntax hint: that way you at least get syntax coloring out of this.
media_type: Option<impl Into<MediaType>>, | ||
) -> anyhow::Result<Self> { | ||
let media_type = media_type.map(Into::into); | ||
let media_type = MediaType::or_guess_from_data(media_type, &contents); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What text types can be guessed from data? O.o
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$ head whatami
<!DOCTYPE html>
<!-- The version of index.html that will be served by app.rerun.io -->
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- Disable zooming: -->
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, user-scalable=no"
/>
$ file --mime-type whatami
./whatami: text/html
🤷
b0a47fe
to
ee5ed0b
Compare
**COMMIT PER COMMIT!** _That's the nasty one... there's always a nasty one 😬_ Introduces the `DataLoader` trait, which can load any file, either from a filepath by reading from the local filesystem, or from a pre-loaded file's contents. `DataLoader`s are run in parallel where possible, and have complete say over what data they are interested in or not (i.e. they are not registered based on an extension, which is very limited in practice). I've decided to commit small example assets for the types we support, cause I feel we really need a fast way of checking whether everything still works from time to time. It's pretty light but might be controversial, I figure. Checks: - [x] `cargo r -p rerun-cli --no-default-features --features native_viewer -- examples/assets/example.{glb,gltf,obj,jpg,png,rrd}` - [x] Native: `File > Open > examples/assets/*` - [x] Native: `Drag-n-drop > examples/assets/*` - [x] Web: `File > Open > examples/assets/*` - [x] Web: `Drag-n-drop > examples/assets/*` --- Part of a series of PRs to make it possible to load _any_ file from the local filesystem, by any means, on web and native: - #4516 - #4517 - #4518 - #4519 - #4520 - #4521 - TODO: register custom loaders - TODO: high level docs and guides for everything related to loading files
21a7fe2
to
bae6752
Compare
`.ply` support, but point clouds only, at least for now. No feature flag: I had some, and tbh it only made thing needlessly hard to work with for very little gains. `.ply` are so common anyway, they always come up in user requests. Here's an example from [there](https://github.com/HuangCongQing/Point-Clouds-Visualization/blob/master/2open3D/data/fragment.ply): ![image](https://github.com/rerun-io/rerun/assets/2910679/8242c5a2-037d-46c6-9816-ab9b240a7473) Checks: - [x] `cargo r -p rerun-cli --no-default-features --features native_viewer -- examples/assets/example.{glb,gltf,obj,jpg,png,rrd,txt,md,ply}` - [x] Native: `File > Open > examples/assets/*` - [x] Native: `Drag-n-drop > examples/assets/*` - [x] Web: `File > Open > examples/assets/*` - [x] Web: `Drag-n-drop > examples/assets/*` --- Part of a series of PRs to make it possible to load _any_ file from the local filesystem, by any means, on web and native: - #4516 - #4517 - #4518 - #4519 - #4520 - #4521 - TODO: register custom loaders - TODO: high level docs and guides for everything related to loading files
Load folders filled with whatever. Go nuts. The loader has no particular semantics (e.g. HIVE partitioning): it just loads everything in a folder using the appropriate loader(s) for each file. Checks: - [x] `cargo r -p rerun-cli --no-default-features --features native_viewer -- examples/assets` - [x] Native: `File > Open > examples/assets/` - [x] Native: `Drag-n-drop > examples/assets/` --- Part of a series of PRs to make it possible to load _any_ file from the local filesystem, by any means, on web and native: - #4516 - #4517 - #4518 - #4519 - #4520 - #4521 - TODO: register custom loaders - TODO: high level docs and guides for everything related to loading files
…#4521) Turn any executable in your `PATH` into a `DataLoader` by logging data to stdout. Includes examples for all supported languages. ![image](https://github.com/rerun-io/rerun/assets/2910679/82391961-9ac1-4bd8-bdbe-a7378ed7a3fa) Checks: - [x] `rerun-loader-rust-file` just prints help message - [x] `rerun-loader-rust-file examples/rust/external_data_loader/src/main.rs` successfully does nothing - [x] `rerun-loader-rust-file examples/rust/external_data_loader/src/main.rs | rerun -` works - [x] `rerun-loader-python-file` just prints help message - [x] `rerun-loader-python-file examples/python/external_data_loader/main.py` successfully does nothing - [x] `rerun-loader-python-file examples/python/external_data_loader/main.py | rerun -` works - [x] `rerun-loader-cpp-file` just prints help message - [x] `rerun-loader-cpp-file examples/cpp/external_data_loader/main.cpp` successfully does nothing - [x] `rerun-loader-cpp-file examples/cpp/external_data_loader/main.cpp | rerun -` works - [x] `cargo r -p rerun-cli --no-default-features --features native_viewer -- examples/assets` - [x] Native: `File > Open > examples/assets/` - [x] Native: `Drag-n-drop > examples/assets/` --- Part of a series of PRs to make it possible to load _any_ file from the local filesystem, by any means, on web and native: - #4516 - #4517 - #4518 - #4519 - #4520 - #4521 - TODO: register custom loaders - TODO: high level docs and guides for everything related to loading files
Introduce a first-class protocol for `DataLoader`s -- whether they are builtin, custom, or external -- to announce that they don't support loading a given piece of data. This fixes one of the oldest issue when loading files in Rerun: loading unsupported data would always bottom out in either the image or websocket paths, leading to unrelated errors very confusing to users. The loading process is now a two-pass process: 1. Dispatch the data to be loaded to all loaders, which will respond ASAP whether they can do it or not. 1.1. If at least one compatible loader is found, go to 2 1.2. Otherwise, fail early with a nice error message for the end user 2. Dispatch the actual data loading. This has important/subtle ramifications on the threading model, but other than that is what you'd expect. Checks: - [x] Native: CLI examples/assets/* - [x] Native: CLI examples/assets - [x] Native: CLI examples/assets/* containing unsupported files - [x] Native: CLI examples/assets containing unsupported files - [x] Native: File>Open examples/assets/* - [x] Native: File>Open examples/assets - [x] Native: File>Open examples/assets/* containing unsupported files - [x] Native: File>Open examples/assets containing unsupported files - [x] Native: Drag-n-drop examples/assets/* - [x] Native: Drag-n-drop examples/assets - [x] Native: Drag-n-drop examples/assets/* containing unsupported files - [x] Native: Drag-n-drop examples/assets containing unsupported files - [x] Web: File>Open examples/assets/* - [x] Web: Drag-n-drop examples/assets/* - [x] Web: File>Open examples/assets/* containing unsupported files - [x] Web: Drag-n-drop examples/assets/* containing unsupported files --- Part of a series of PRs to make it possible to load _any_ file from the local filesystem, by any means, on web and native: - #4516 - #4517 - #4518 - #4519 - #4520 - #4521 - #4565 - #4566 - #4567
Add support for registering custom loaders, the same way we offer support for registering custom space views and store subscribers. Checks: - [x] cargo r -p custom_data_loader -- Cargo.toml --- Part of a series of PRs to make it possible to load _any_ file from the local filesystem, by any means, on web and native: - #4516 - #4517 - #4518 - #4519 - #4520 - #4521 - #4565 - #4566 - #4567
Some docs for the whole thing. It heavily relies on linking to the examples for exact details and to avoid rot. It's probably extremely bad. Help welcome. --- Part of a series of PRs to make it possible to load _any_ file from the local filesystem, by any means, on web and native: - #4516 - #4517 - #4518 - #4519 - #4520 - #4521 - #4565 - #4566 - #4567 Co-authored-by: Nikolaus West <[email protected]>
What the title says.
Checks:
cargo r -p rerun-cli --no-default-features --features native_viewer -- examples/assets/example.{glb,gltf,obj,jpg,png,rrd,txt,md}
File > Open > examples/assets/*
Drag-n-drop > examples/assets/*
File > Open > examples/assets/*
Drag-n-drop > examples/assets/*
Part of a series of PRs to make it possible to load any file from the local filesystem, by any means, on web and native:
DataLoader
s 0: utility for hierarchicalEntityPath
from file path #4516DataLoader
s 1: introduce, and migrate to,DataLoader
s #4517DataLoader
s 2: add text-basedDataLoader
(.txt
,.md
) #4518DataLoader
s 3: add 3D point cloudDataLoader
(.ply
) #4519DataLoader
s 4: add generic folderDataLoader
#4520DataLoader
s 5: add support for external binaryDataLoader
s (PATH) #4521Checklist