Skip to content

rerun_py always enables all of rerun's default-flags #2024

@teh-cmc

Description

@teh-cmc

rerun_py imports rerun like this:

rerun = { workspace = true, default-features = false, features = [
  "analytics",
  "server",
  "sdk",
] }

So you'd think you wouldn't get a viewer with that, right? Wrong:

$ cargo tree --no-default-features -i re_viewer

re_viewer v0.6.0-alpha.0 (/home/cmc/dev/rerun-io/rerun/crates/re_viewer)
└── rerun v0.6.0-alpha.0 (/home/cmc/dev/rerun-io/rerun/crates/rerun)
    └── rerun_py v0.6.0-alpha.0 (/home/cmc/dev/rerun-io/rerun/rerun_py)

The reason is because rerun default features are declared as:

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

and then rerun is advertised to the workspace as:

rerun = { path = "crates/rerun", version = "=0.6.0-alpha.0" }

which implies defaults-features = true, and cannot be overridden since features are implicitly additive!!!!

(Note: starting with Rust 1.69, the current setup actually yields a (pretty cryptic) warning: rerun-io/rerun/rerun_py/Cargo.toml: default-features is ignored for rerun, since default-features was not specified for workspace.dependencies.rerun, this could become a hard error in the future)

Now the issue is that we definitely don't want to change those default features, as they are in fact the correct defaults for anyone importing the main library (including our official Rust examples!).

If the advertised rerun feature flags at the workspace level only impact usage from within the workspace, then one possible solution is to set default-features = false at the workspace level, and make the examples import the release crate instead?

Metadata

Metadata

Assignees

No one assigned

    Labels

    dependenciesconcerning crates, pip packages etcsdk-pythonPython logging API

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions