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

Print detailed version/build info #1313

Closed
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
118 changes: 118 additions & 0 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,6 @@ debug = true
# If that is not possible, patch to a branch that has a PR open on the upstream repo.
# As a last resport, patch with a commit to our own repository.
# ALWAYS document what PR the commit hash is part of, or when it was merged into the upstream trunk.

# Upstream PR https://github.com/baoyachi/shadow-rs/pull/128
shadow-rs = { git = "https://github.com/rerun-io/shadow-rs", branch = "john/fix_gen_docs" }
4 changes: 4 additions & 0 deletions crates/rerun/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ crossbeam = "0.8"
document-features = "0.2"
egui = { workspace = true, default-features = false }
puffin.workspace = true
shadow-rs = "0.20"

# Optional dependencies:
re_analytics = { workspace = true, optional = true }
Expand All @@ -81,3 +82,6 @@ clap = { workspace = true, features = ["derive"] }
mimalloc = "0.1.29"
puffin_http = "0.11"
tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }

[build-dependencies]
shadow-rs = "0.20"
3 changes: 3 additions & 0 deletions crates/rerun/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() -> shadow_rs::SdResult<()> {
shadow_rs::new()
}
2 changes: 2 additions & 0 deletions crates/rerun/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,5 @@ pub use run::{run, CallSource};
// NOTE: Have a look at `re_sdk/src/lib.rs` for an accurate listing of all these symbols.
#[cfg(feature = "sdk")]
pub use re_sdk::*;

shadow_rs::shadow!(build);
2 changes: 1 addition & 1 deletion crates/rerun/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use clap::Subcommand;
///
/// * `RERUN_TRACK_ALLOCATIONS`: track all allocations in order to find memory leaks in the viewer. WARNING: slows down the viewer by a lot!
#[derive(Debug, clap::Parser)]
#[clap(author, version, about)]
#[clap(author, version = crate::build::CLAP_LONG_VERSION, about)]
struct Args {
/// Either a path to a `.rrd` file to load, or a websocket url to a Rerun Server from which to read data
///
Expand Down
2 changes: 1 addition & 1 deletion rerun_py/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ classifiers = [
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Scientific/Engineering :: Visualization",
]
dependencies = ["deprecated", "numpy>=1.23", "pyarrow==10.0.1"]
dependencies = ["deprecated", "numpy>=1.23", "pyarrow==10.0.1", "semver>=2.13"]
description = "The Rerun Logging SDK"
keywords = ["computer-vision", "logging", "rerun"]
name = "rerun-sdk"
Expand Down
14 changes: 14 additions & 0 deletions rerun_py/rerun_sdk/rerun/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from typing import Optional

import rerun_bindings as bindings # type: ignore[attr-defined]
import semver
from rerun.log import log_cleared
from rerun.log.annotation import log_annotation_context
from rerun.log.arrow import log_arrow
Expand Down Expand Up @@ -73,6 +74,19 @@ def unregister_shutdown() -> None:
# -----------------------------------------------------------------------------


def get_version() -> semver.VersionInfo:
"""
Get the version of the Rerun SDK.

Returns
-------
semver.VersionInfo
The version of the Rerun SDK.

"""
return semver.parse_version_info(bindings.get_version())


def get_recording_id() -> str:
"""
Get the recording ID that this process is logging to, as a UUIDv4.
Expand Down
6 changes: 6 additions & 0 deletions rerun_py/src/python_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ fn rerun_bindings(py: Python<'_>, m: &PyModule) -> PyResult<()> {
global_session().set_recording_id(default_recording_id(py));

m.add_function(wrap_pyfunction!(main, m)?)?;
m.add_function(wrap_pyfunction!(get_version, m)?)?;

m.add_function(wrap_pyfunction!(get_registered_component_names, m)?)?;

Expand Down Expand Up @@ -211,6 +212,11 @@ fn main(argv: Vec<String>) -> PyResult<u8> {
.map_err(|err| PyRuntimeError::new_err(re_error::format(err)))
}

#[pyfunction]
fn get_version() -> &'static str {
rerun::build::PKG_VERSION
}

#[pyfunction]
fn get_recording_id() -> PyResult<String> {
global_session()
Expand Down