Skip to content

Commit 80849ce

Browse files
Weijun-HWumpf
andauthored
Remove deprecated methods from AnyValues (#11390)
Co-authored-by: Andreas Reich <[email protected]>
1 parent c1b2ab4 commit 80849ce

File tree

4 files changed

+6
-84
lines changed

4 files changed

+6
-84
lines changed

crates/store/re_types/src/any_values.rs

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
//! Utilities to log arbitrary data to Rerun.
22
3-
use crate::{
4-
ArchetypeName, Component, SerializedComponentBatch, dynamic_archetype::DynamicArchetype,
5-
};
3+
use crate::{Component, SerializedComponentBatch, dynamic_archetype::DynamicArchetype};
64
use re_types_core::{AsComponents, ComponentType, Loggable};
75

86
/// A helper for logging arbitrary data to Rerun.
@@ -20,19 +18,6 @@ impl Default for AnyValues {
2018
}
2119

2220
impl AnyValues {
23-
//TODO(#10908): Prune this method in 0.26.0
24-
/// Assigns an (archetype) name to this set of any values.
25-
#[deprecated(
26-
since = "0.25.0",
27-
note = "Use of archetype leads to ambiguity whether provided field names should be prefixed to be unique. Refer to dynamic_archetype instead for an unambiguous usage."
28-
)]
29-
#[inline]
30-
pub fn new(archetype_name: impl Into<ArchetypeName>) -> Self {
31-
Self {
32-
builder: DynamicArchetype::new(archetype_name),
33-
}
34-
}
35-
3621
/// Adds a component generated from arbitrary data to this collection.
3722
///
3823
/// In many cases, it might be more convenient to use [`Self::with_component`] to log an existing Rerun component instead.
@@ -47,18 +32,6 @@ impl AnyValues {
4732
}
4833
}
4934

50-
//TODO(#10908): Prune this method in 0.26.0
51-
/// Adds a field of arbitrary data to this collection.
52-
///
53-
/// In many cases, it might be more convenient to use [`Self::with_component`] to log an existing Rerun component instead.
54-
#[deprecated(since = "0.25.0", note = "Use with_component_from_data instead.")]
55-
#[inline]
56-
pub fn with_field(self, field: impl AsRef<str>, array: arrow::array::ArrayRef) -> Self {
57-
Self {
58-
builder: self.builder.with_component_from_data(field, array),
59-
}
60-
}
61-
6235
/// Adds an existing Rerun [`Component`] to this collection.
6336
#[inline]
6437
pub fn with_component<C: Component>(
@@ -87,25 +60,6 @@ impl AnyValues {
8760
.with_component_override(field, component_type, loggable),
8861
}
8962
}
90-
91-
//TODO(#10908): Prune this method in 0.26.0
92-
/// Adds an existing Rerun [`Component`] to this collection.
93-
///
94-
/// This method can be used to override the component type.
95-
#[deprecated(since = "0.25.0", note = "Use with_component_override instead.")]
96-
#[inline]
97-
pub fn with_loggable<L: Loggable>(
98-
self,
99-
field: impl AsRef<str>,
100-
component_type: impl Into<ComponentType>,
101-
loggable: impl IntoIterator<Item = impl Into<L>>,
102-
) -> Self {
103-
Self {
104-
builder: self
105-
.builder
106-
.with_component_override(field, component_type, loggable),
107-
}
108-
}
10963
}
11064

11165
impl AsComponents for AnyValues {

rerun_py/rerun_sdk/rerun/any_value.py

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
from __future__ import annotations
22

3-
import warnings
43
from typing import Any
54

65
from typing_extensions import deprecated
76

8-
from rerun._baseclasses import ComponentDescriptor
9-
107
from ._baseclasses import ComponentColumn, ComponentColumnList, DescribedComponentBatch
118
from ._log import AsComponents
129
from .dynamic_archetype import DynamicArchetype
@@ -83,26 +80,12 @@ def __init__(self, drop_untyped_nones: bool = True, **kwargs: Any) -> None:
8380
@deprecated(
8481
"`rr.AnyValues.with_field` is deprecated, use `rr.AnyValues.with_component_from_data` instead.",
8582
)
86-
def with_field(
87-
self, descriptor: str | ComponentDescriptor, value: Any, *, drop_untyped_nones: bool = True
88-
) -> AnyValues:
83+
def with_field(self, descriptor: str, value: Any, *, drop_untyped_nones: bool = True) -> AnyValues:
8984
return self.with_component_from_data(descriptor, value, drop_untyped_nones=drop_untyped_nones)
9085

91-
def with_component_from_data(
92-
self, descriptor: str | ComponentDescriptor, value: Any, *, drop_untyped_nones: bool = True
93-
) -> AnyValues:
86+
def with_component_from_data(self, descriptor: str, value: Any, *, drop_untyped_nones: bool = True) -> AnyValues:
9487
"""Adds an `AnyValueBatch` to this `AnyValues` bundle."""
95-
# TODO(#10908): Prune this type in 0.26
96-
if isinstance(descriptor, ComponentDescriptor):
97-
warnings.warn(
98-
"`rr.AnyValues.with_field` using a component descriptor is deprecated, "
99-
"use DynamicArchetype if trying to specify archetype grouping of values.",
100-
DeprecationWarning,
101-
stacklevel=2,
102-
)
103-
self._builder._with_descriptor_internal(descriptor, value, drop_untyped_nones=drop_untyped_nones)
104-
else:
105-
self._builder.with_component_from_data(descriptor, value, drop_untyped_nones=drop_untyped_nones)
88+
self._builder.with_component_from_data(descriptor, value, drop_untyped_nones=drop_untyped_nones)
10689
return self
10790

10891
@deprecated(
@@ -183,4 +166,4 @@ def columns(cls, drop_untyped_nones: bool = True, **kwargs: Any) -> ComponentCol
183166

184167
@property
185168
def component_batches(self) -> list[DescribedComponentBatch]:
186-
return self._builder.component_batches
169+
return self._builder.as_component_batches()

rerun_py/rerun_sdk/rerun/dynamic_archetype.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from __future__ import annotations
22

3-
import warnings
43
from typing import TYPE_CHECKING, Any
54

65
from rerun._baseclasses import ComponentDescriptor
@@ -226,13 +225,3 @@ def columns(
226225
return ComponentColumnList([
227226
ComponentColumn(batch.component_descriptor(), batch) for batch in inst._component_batches
228227
])
229-
230-
@property
231-
def component_batches(self) -> list[DescribedComponentBatch]:
232-
# TODO(#10908): Prune this type in 0.26
233-
warnings.warn(
234-
"Accessing `component_batches` directly is deprecated, access via `as_component_batches` instead.",
235-
DeprecationWarning,
236-
stacklevel=3,
237-
)
238-
return self._component_batches

rerun_py/tests/unit/test_any_values.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,6 @@ def test_any_values_numpy() -> None:
193193

194194
def test_any_values_with_field() -> None:
195195
rr.set_strict_mode(False)
196-
with pytest.warns(DeprecationWarning, match="`rr.AnyValues.with_field` using a component descriptor is deprecated"):
197-
values = rr.AnyValues().with_component_from_data(
198-
descriptor=rr.ComponentDescriptor("value"),
199-
value=np.array([5], dtype=np.int64),
200-
)
196+
values = rr.AnyValues().with_component_from_data(descriptor="value", value=np.array([5], dtype=np.int64))
201197
assert values.as_component_batches()[0].component_descriptor() == rr.ComponentDescriptor("value")
202198
assert values.as_component_batches()[0].as_arrow_array().to_numpy() == np.array([5], dtype=np.int64)

0 commit comments

Comments
 (0)