Skip to content
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

cargo install rerun-cli #2183

Merged
merged 7 commits into from
May 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
[alias]
# `cargo rerun` is short a convenient shorthand, skipping the web viewer.
rerun = "run --package rerun-cli --no-default-features --features native_viewer --"

# To easily run examples on the web, see https://github.com/rukai/cargo-run-wasm.
# Temporary solution while we wait for our own xtasks!
run-wasm = "run --release --package run_wasm --"
Expand Down
3 changes: 3 additions & 0 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ This is a guide to how to build Rerun.
* Run `./scripts/setup_dev.sh`.
* Make sure `cargo --version` prints `1.69.0` once you are done

All Rust examples are separate executable projections. Meaning to run them you specify the package, e.g. `cargo run -p dna`.

You can type `cargo rerun` to compile and run the `rerun` binary with most features enabled, thanks to a shortcut in `.cargo/config.toml`.

### Apple-silicon Macs

Expand Down
16 changes: 15 additions & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ rr.log_rect("car", bbox)
### Rerun Viewer binary
Both the Python and Rust library can start the Rerun Viewer, but to stream log data over the network or load our `.rrd` data files you also need the `rerun` binary.

It can be installed with `pip install rerun-sdk` or with `cargo install rerun`.
It can be installed with `pip install rerun-sdk` or with `cargo install rerun-cli`.

You should now be able to run `rerun --help` in any terminal.

Expand Down
7 changes: 6 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ This is a living document. Strive to improve it on each new release.
* [ ] Editorialize the changelog if necessary
* [ ] Make sure the changelog includes instructions for handling any breaking changes
* [ ] Commit and push the changelog
* [ ] Check that the [`rerun-docs`](https://github.com/rerun-io/rerun-docs) are up to date:
* [ ] Python quick start
* [ ] Logging Data in Python
* [ ] Rust quick start
* [ ] Logging Data in Rust
* [ ] Create a draft PR containing:
* [ ] One-line summary of the release
* [ ] A multi-line summary of the release
Expand Down Expand Up @@ -96,7 +101,7 @@ Before pushing the release tag:

After tagging and the CI has published:
* [ ] Test the Python packages from PyPI: `pip install rerun_sdk==0.x.0a1`
* [ ] Test rust install version: `cargo install -f [email protected] -F web_viewer && rerun --web-viewer api.rrd`
* [ ] Test rust install version: `cargo install --force rerun-cli@0.x.0-alpha.1 && rerun --web-viewer api.rrd`
* [ ] Test rust crate: Modify Cargo.toml of any example to not point to the workspace
* [ ] run with `--serve` to test web player

Expand Down
62 changes: 62 additions & 0 deletions crates/rerun-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
[package]
name = "rerun-cli"
authors.workspace = true
categories = ["visualization", "computer-vision"]
default-run = "rerun"
description = "Log images, point clouds, etc, and visualize them effortlessly"
edition.workspace = true
homepage.workspace = true
include.workspace = true
keywords = ["mesh", "plotting", "point-cloud", "robotics", "visualization"]
license.workspace = true
publish = true
readme = "README.md"
repository.workspace = true
rust-version.workspace = true
version.workspace = true

[package.metadata.docs.rs]
all-features = true
targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"]


[features]
# The default is what the user gets when they call `cargo install rerun-cli`,
# so wer have all the bells and wistles here
default = ["native_viewer", "web_viewer"]

## Support spawning a native viewer.
## This adds a lot of extra dependencies, so only enable this feature if you need it!
native_viewer = ["rerun/native_viewer"]

## Support serving a web viewer over HTTP.
emilk marked this conversation as resolved.
Show resolved Hide resolved
##
## Enabling this inflates the binary size quite a bit, since it embeds the viewer wasm.
# When building from source (in the repository), this feature adds quite a bit
# to the compile time since it requires compiling and bundling the viewer as wasm.
#
# You also need to install some additional tools, which you can do by running
# [`scripts/setup_web.sh`](https://github.com/rerun-io/rerun/blob/main/scripts/setup_web.sh).
web_viewer = ["rerun/web_viewer"]

[dependencies]
re_build_info.workspace = true
re_log.workspace = true
re_memory.workspace = true
rerun = { workspace = true, features = [
"analytics",
"demo",
"glam",
"image",
"sdk",
"server",
] }

anyhow.workspace = true
document-features = "0.2"
mimalloc.workspace = true
tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }


[build-dependencies]
re_build_build_info.workspace = true
35 changes: 35 additions & 0 deletions crates/rerun-cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<h1 align="center">
<a href="https://www.rerun.io/">
<img alt="banner" src="https://user-images.githubusercontent.com/1148717/218142418-1d320929-6b7a-486e-8277-fbeef2432529.png">
</a>
</h1>

<h1 align="center">
<a href="https://crates.io/crates/rerun-cli"> <img alt="Latest version" src="https://img.shields.io/crates/v/rerun-cli.svg"> </a>
<a href="https://docs.rs/rerun-cli"> <img alt="Documentation" src="https://docs.rs/rerun-cli/badge.svg"> </a>
<a href="https://github.com/rerun-io/rerun/blob/master/LICENSE-MIT"> <img alt="MIT" src="https://img.shields.io/badge/license-MIT-blue.svg"> </a>
<a href="https://github.com/rerun-io/rerun/blob/master/LICENSE-APACHE"> <img alt="Apache" src="https://img.shields.io/badge/license-Apache-blue.svg"> </a>
<a href="https://discord.gg/Gcm8BbTaAj"> <img alt="Rerun Discord" src="https://img.shields.io/discord/1062300748202921994?label=Rerun%20Discord"> </a>
</h1>

## Rerun command-line tool
You can install the binary with `cargo install rerun-cli`

This can act either as a server, a viewer, or both, depending on which options you use when you start it.

Running `rerun` with no arguments will start the viewer, waiting for an SDK to connect to it over TCP.

Run `rerun --help` for more.


## What is Rerun?
- [Examples](https://github.com/rerun-io/rerun/tree/latest/examples/rust)
- [High-level docs](http://rerun.io/docs)
- [Rust API docs](https://docs.rs/rerun/)
- [Troubleshooting](https://www.rerun.io/docs/getting-started/troubleshooting)


### Running a web viewer
```sh
rerun --web-viewer ../nyud.rrd
```
4 changes: 4 additions & 0 deletions crates/rerun-cli/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fn main() {
re_build_build_info::rebuild_if_crate_changed("rerun-cli");
re_build_build_info::export_env_vars();
}
26 changes: 26 additions & 0 deletions crates/rerun-cli/src/bin/rerun.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//! The `rerun` binary, part of the [`rerun`](https://github.com/rerun-io/rerun) family of crates.
//!
//! Run `rerun --help` for more information.
//!
//! ## Feature flags
#![doc = document_features::document_features!()]
//!
//! ## Links
//! - [Examples](https://github.com/rerun-io/rerun/tree/latest/examples/rust)
//! - [High-level docs](http://rerun.io/docs)
//! - [Rust API docs](https://docs.rs/rerun/)
//! - [Troubleshooting](https://www.rerun.io/docs/getting-started/troubleshooting)
use re_memory::AccountingAllocator;

#[global_allocator]
static GLOBAL: AccountingAllocator<mimalloc::MiMalloc> =
AccountingAllocator::new(mimalloc::MiMalloc);

#[tokio::main]
async fn main() -> anyhow::Result<std::process::ExitCode> {
re_log::setup_native_logging();
let build_info = re_build_info::build_info!();
rerun::run(build_info, rerun::CallSource::Cli, std::env::args())
.await
.map(std::process::ExitCode::from)
}
14 changes: 2 additions & 12 deletions crates/rerun/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
name = "rerun"
authors.workspace = true
categories = ["visualization", "computer-vision"]
default-run = "rerun"
description = "Log images, point clouds, etc, and visualize them effortlessly"
edition.workspace = true
homepage.workspace = true
Expand All @@ -21,15 +20,7 @@ targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"]


[features]
default = [
"analytics",
"demo",
"glam",
"image",
"native_viewer",
"server",
"sdk",
]
default = ["analytics", "demo", "glam", "image", "sdk", "server"]

## Enable telemetry using our analytics SDK.
analytics = [
Expand All @@ -52,7 +43,7 @@ image = ["re_log_types/image", "re_sdk?/image"]
## This adds a lot of extra dependencies, so only enable this feature if you need it!
native_viewer = ["dep:re_viewer"]

## Support for running a HTTP server that listens to incoming log messages from a Rerun SDK.
## Support for running a TCP server that listens to incoming log messages from a Rerun SDK.
server = ["re_sdk_comms/server"]

## Embed the Rerun SDK and re-export all of its public symbols.
Expand Down Expand Up @@ -102,7 +93,6 @@ webbrowser = { version = "0.8", optional = true }
backtrace = "0.3"
clap = { workspace = true, features = ["derive"] }
ctrlc.workspace = true
mimalloc.workspace = true
puffin.workspace = true
rayon.workspace = true
tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }
Expand Down
3 changes: 1 addition & 2 deletions crates/rerun/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ You can add the `rerun` crate to your project with `cargo add rerun`.
To get started, see [the examples](https://github.com/rerun-io/rerun/tree/latest/examples/rust).
## Binary
You can install the binary with `cargo install rerun`
You can install the binary with `cargo install rerun-cli`
This can act either as a server, a viewer, or both, depending on which options you use when you start it.
Expand All @@ -59,6 +59,5 @@ Run `rerun --help` for more.
The web viewer is an experimental feature, but you can try it out with:
```sh
cargo install --features web rerun
rerun --web-viewer ../nyud.rrd
```
2 changes: 1 addition & 1 deletion crates/rerun/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! There is also a `rerun` binary.
//! The binary is required in order to stream log data
//! over the networks, and to open our `.rrd` data files.
//! If you need it, install the `rerun` binary with `cargo install rerun`.
//! If you need it, install the `rerun` binary with `cargo install rerun-cli`.
//!
//! ## Feature flags
#![doc = document_features::document_features!()]
Expand Down
14 changes: 0 additions & 14 deletions crates/rerun/src/main.rs

This file was deleted.

2 changes: 1 addition & 1 deletion crates/rerun/src/web_viewer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl crate::sink::LogSink for WebViewerSink {
/// If the `open_browser` argument is `true`, your default browser
/// will be opened with a connected web-viewer.
///
/// If not, you can connect to this server using the `rerun` binary (`cargo install rerun`).
/// If not, you can connect to this server using the `rerun` binary (`cargo install rerun-cli`).
///
/// NOTE: you can not connect one `Session` to another.
///
Expand Down
5 changes: 4 additions & 1 deletion examples/rust/api_demo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ license = "MIT OR Apache-2.0"
publish = false

[dependencies]
rerun = { path = "../../../crates/rerun", features = ["web_viewer"] }
rerun = { path = "../../../crates/rerun", features = [
"native_viewer",
"web_viewer",
] }

anyhow = "1.0"
clap = { version = "4.0", features = ["derive"] }
Expand Down
5 changes: 4 additions & 1 deletion examples/rust/clock/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ license = "MIT OR Apache-2.0"
publish = false

[dependencies]
rerun = { path = "../../../crates/rerun", features = ["web_viewer"] }
rerun = { path = "../../../crates/rerun", features = [
"native_viewer",
"web_viewer",
] }

anyhow = "1.0"
clap = { version = "4.0", features = ["derive"] }
Expand Down
2 changes: 1 addition & 1 deletion examples/rust/dna/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0"
publish = false

[dependencies]
rerun = { path = "../../../crates/rerun", features = ["web_viewer"] }
rerun = { path = "../../../crates/rerun", features = ["native_viewer"] }

itertools = "0.10"
rand = "0.8"
2 changes: 1 addition & 1 deletion examples/rust/minimal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ license = "MIT OR Apache-2.0"
publish = false

[dependencies]
rerun = { path = "../../../crates/rerun" }
rerun = { path = "../../../crates/rerun", features = ["native_viewer"] }
5 changes: 4 additions & 1 deletion examples/rust/minimal_options/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ license = "MIT OR Apache-2.0"
publish = false

[dependencies]
rerun = { path = "../../../crates/rerun", features = ["web_viewer"] }
rerun = { path = "../../../crates/rerun", features = [
"native_viewer",
"web_viewer",
] }

anyhow = "1.0"
clap = { version = "4.0", features = ["derive"] }
Expand Down
5 changes: 4 additions & 1 deletion examples/rust/objectron/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ publish = false


[dependencies]
rerun = { path = "../../../crates/rerun", features = ["web_viewer"] }
rerun = { path = "../../../crates/rerun", features = [
"native_viewer",
"web_viewer",
] }

anyhow = "1.0"
clap = { version = "4.0", features = ["derive"] }
Expand Down
5 changes: 4 additions & 1 deletion examples/rust/raw_mesh/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ license = "MIT OR Apache-2.0"
publish = false

[dependencies]
rerun = { path = "../../../crates/rerun", features = ["web_viewer"] }
rerun = { path = "../../../crates/rerun", features = [
"native_viewer",
"web_viewer",
] }

anyhow = "1.0"
bytes = "1.3"
Expand Down
1 change: 1 addition & 0 deletions scripts/publish_crates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,6 @@ cargo publish $FLAGS -p re_data_ui
cargo publish $FLAGS -p re_viewer
cargo publish $FLAGS -p re_sdk
cargo publish $FLAGS -p rerun
cargo publish $FLAGS -p rerun-cli

echo "All crates successfully published!"