Skip to content

Commit

Permalink
Dataframe view update and blueprint API (part 0): introduce view obje…
Browse files Browse the repository at this point in the history
…ct and improve doc generation (#7515)

### What

This PR introduces a stub blueprint view object for the dataframe view.
It doesn't contain any actual parameters (query, etc.), but is
sufficient to "spawn" a view. This PR also improves doc generation by
special casing the dataframe view (it accepts all archetypes and
inversely).

(Note: the snippet will be much improved in later PRs.)

<img width="673" alt="image"
src="https://github.com/user-attachments/assets/8a945f46-a6a8-44c6-ab88-db8d19e6992a">


![image](https://github.com/user-attachments/assets/0b1b4db5-5afa-41f9-914d-af04c21e34e0)


<hr>

Part of a series to address #6896 and #7498.

All PRs:
- #7515
- #7516
- #7527 
- #7545
- #7551
- #7572
- #7573

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested the web demo (if applicable):
* Using examples from latest `main` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/7515?manifest_url=https://app.rerun.io/version/main/examples_manifest.json)
* Using full set of examples from `nightly` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/7515?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json)
* [x] The PR title and labels are set such as to maximize their
usefulness for the next release's CHANGELOG
* [x] If applicable, add a new check to the [release
checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)!
* [x] If have noted any breaking changes to the log API in
`CHANGELOG.md` and the migration guide

- [PR Build Summary](https://build.rerun.io/pr/7515)
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)

To run all checks from `main`, comment on the PR with `@rerun-bot
full-check`.
  • Loading branch information
abey79 authored Oct 3, 2024
1 parent 85686a4 commit 6290f79
Show file tree
Hide file tree
Showing 45 changed files with 279 additions and 14 deletions.
40 changes: 26 additions & 14 deletions crates/build/re_types_builder/src/codegen/docs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ use crate::{
ATTR_DOCS_VIEW_TYPES,
};

pub const DATAFRAME_VIEW_FQNAME: &str = "rerun.blueprint.views.DataframeView";

macro_rules! putln {
($o:ident) => ( writeln!($o).ok() );
($o:ident, $($tt:tt)*) => ( writeln!($o, $($tt)*).ok() );
Expand Down Expand Up @@ -574,9 +576,10 @@ fn write_archetype_fields(
putln!(page, "**Optional**: {}", optional.join(", "));
}

putln!(page);
putln!(page, "## Shown in");

if let Some(view_types) = view_per_archetype.get(&object.fqname) {
putln!(page);
putln!(page, "## Shown in");
for ViewReference {
view_name,
explanation,
Expand All @@ -592,6 +595,9 @@ fn write_archetype_fields(
putln!(page);
}
}

// Special case for dataframe view: it can display anything.
putln!(page, "* [DataframeView](../views/dataframe_view.md)");
}

fn write_visualized_archetypes(
Expand All @@ -614,7 +620,7 @@ fn write_visualized_archetypes(
}
}

if archetype_fqnames.is_empty() {
if archetype_fqnames.is_empty() && view.fqname != DATAFRAME_VIEW_FQNAME {
reporter.error(&view.virtpath, &view.fqname, "No archetypes use this view.");
return;
}
Expand All @@ -624,18 +630,24 @@ fn write_visualized_archetypes(

putln!(page, "## Visualized archetypes");
putln!(page);
for (fqname, explanation) in archetype_fqnames {
let object = &objects[&fqname];
page.push_str(&format!(
"* [`{}`](../{}/{}.md)",
object.name,
object.kind.plural_snake_case(),
object.snake_case_name()
));
if let Some(explanation) = explanation {
page.push_str(&format!(" ({explanation})"));

// special case for dataframe view
if view.fqname == DATAFRAME_VIEW_FQNAME {
putln!(page, "Any data can be displayed by the Dataframe view.");
} else {
for (fqname, explanation) in archetype_fqnames {
let object = &objects[&fqname];
page.push_str(&format!(
"* [`{}`](../{}/{}.md)",
object.name,
object.kind.plural_snake_case(),
object.snake_case_name()
));
if let Some(explanation) = explanation {
page.push_str(&format!(" ({explanation})"));
}
putln!(page);
}
putln!(page);
}
putln!(page);
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace rerun.blueprint.views;

/// A view to display any data in a tabular form.
///
/// \example views/dataframe title="Use a blueprint to customize a DataframeView."
//TODO(#6896): add a thumbnail when the example becomes interesting
table DataframeView (
"attr.rerun.view_identifier": "Dataframe"
) {
/// Query of the dataframe.
//TODO(#6896): this will be enabled in a later PR in the chain
//query: rerun.blueprint.archetypes.DataframeQueryV2 (order: 1000);
}
1 change: 1 addition & 0 deletions crates/store/re_types/src/blueprint/views/.gitattributes

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions crates/store/re_types/src/blueprint/views/dataframe_view.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions crates/store/re_types/src/blueprint/views/mod.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/arrows2d.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/arrows3d.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/asset3d.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions docs/content/reference/types/archetypes/asset_video.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/bar_chart.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/boxes2d.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/boxes3d.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/clear.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/depth_image.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/ellipsoids3d.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/encoded_image.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/image.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/line_strips2d.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/line_strips3d.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/mesh3d.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/pinhole.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/points2d.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/points3d.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/scalar.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/series_line.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/series_point.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/tensor.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/text_document.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/text_log.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/reference/types/archetypes/transform3d.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6290f79

Please sign in to comment.