diff --git a/crates/re_types/build.rs b/crates/re_types/build.rs index 87ab8045bc9d..59aff38f3b3f 100644 --- a/crates/re_types/build.rs +++ b/crates/re_types/build.rs @@ -14,7 +14,8 @@ const ENTRYPOINT_PATH: &str = "./definitions/rerun/archetypes.fbs"; const DOC_EXAMPLES_DIR_PATH: &str = "../../docs/code-examples"; const CPP_OUTPUT_DIR_PATH: &str = "../../rerun_cpp"; const RUST_OUTPUT_DIR_PATH: &str = "."; -const PYTHON_OUTPUT_DIR_PATH: &str = "../../rerun_py/rerun_sdk/rerun/_rerun2"; +const PYTHON_OUTPUT_DIR_PATH: &str = "../../rerun_py/rerun_sdk/rerun"; +const PYTHON_TESTING_OUTPUT_DIR_PATH: &str = "../../rerun_py/tests/test_types"; fn main() { if cfg!(target_os = "windows") { @@ -92,6 +93,7 @@ fn main() { || { re_types_builder::generate_python_code( PYTHON_OUTPUT_DIR_PATH, + PYTHON_TESTING_OUTPUT_DIR_PATH, &objects, &arrow_registry, ); diff --git a/crates/re_types/source_hash.txt b/crates/re_types/source_hash.txt index 6fb9f79c4a78..f24af95f26fb 100644 --- a/crates/re_types/source_hash.txt +++ b/crates/re_types/source_hash.txt @@ -1,4 +1,4 @@ # This is a sha256 hash for all direct and indirect dependencies of this crate's build script. # It can be safely removed at anytime to force the build script to run again. # Check out build.rs to see how it's computed. -dd8ba38af18880a06a0d4592795455d37b3ed27ba0ce8861c04d74b074b95313 +79a443d822b813f965803039b0a2e9a10f494e5a1273dc46146bb57b68112b84 diff --git a/crates/re_types_builder/src/bin/build_re_types.rs b/crates/re_types_builder/src/bin/build_re_types.rs index 3be0579bb4bb..8375609d94aa 100644 --- a/crates/re_types_builder/src/bin/build_re_types.rs +++ b/crates/re_types_builder/src/bin/build_re_types.rs @@ -6,7 +6,8 @@ const DEFINITIONS_DIR_PATH: &str = "crates/re_types/definitions"; const ENTRYPOINT_PATH: &str = "crates/re_types/definitions/rerun/archetypes.fbs"; const CPP_OUTPUT_DIR_PATH: &str = "rerun_cpp"; const RUST_OUTPUT_DIR_PATH: &str = "crates/re_types/."; -const PYTHON_OUTPUT_DIR_PATH: &str = "rerun_py/rerun_sdk/rerun/_rerun2"; +const PYTHON_OUTPUT_DIR_PATH: &str = "rerun_py/rerun_sdk/rerun"; +const PYTHON_TESTING_OUTPUT_DIR_PATH: &str = "rerun_py/tests/test_types"; fn main() { re_log::setup_native_logging(); @@ -42,6 +43,7 @@ fn main() { let cpp_output_dir_path = workspace_dir.join(CPP_OUTPUT_DIR_PATH); let rust_output_dir_path = workspace_dir.join(RUST_OUTPUT_DIR_PATH); let python_output_dir_path = workspace_dir.join(PYTHON_OUTPUT_DIR_PATH); + let python_testing_output_dir_path = workspace_dir.join(PYTHON_TESTING_OUTPUT_DIR_PATH); re_log::info!("Running codegen…"); let (objects, arrow_registry) = @@ -54,6 +56,7 @@ fn main() { || { re_types_builder::generate_python_code( python_output_dir_path, + python_testing_output_dir_path, &objects, &arrow_registry, ); diff --git a/crates/re_types_builder/src/codegen/python.rs b/crates/re_types_builder/src/codegen/python.rs index 59a8c1cf4df2..35806af02ec2 100644 --- a/crates/re_types_builder/src/codegen/python.rs +++ b/crates/re_types_builder/src/codegen/python.rs @@ -66,12 +66,14 @@ impl PythonObjectExt for Object { pub struct PythonCodeGenerator { pkg_path: Utf8PathBuf, + testing_pkg_path: Utf8PathBuf, } impl PythonCodeGenerator { - pub fn new(pkg_path: impl Into) -> Self { + pub fn new(pkg_path: impl Into, testing_pkg_path: impl Into) -> Self { Self { pkg_path: pkg_path.into(), + testing_pkg_path: testing_pkg_path.into(), } } } @@ -89,6 +91,8 @@ impl CodeGenerator for PythonCodeGenerator { } { + // TODO(jleibs): Should we still be generating an equivalent to this? + /* let archetype_names = objects .ordered_objects(ObjectKind::Archetype.into()) .iter() @@ -98,9 +102,10 @@ impl CodeGenerator for PythonCodeGenerator { self.pkg_path.join("__init__.py"), lib_source_code(&archetype_names), ); + */ } - write_files(&self.pkg_path, &files_to_write); + self.write_files(&files_to_write); let filepaths = files_to_write.keys().cloned().collect(); @@ -235,14 +240,20 @@ impl PythonCodeGenerator { files_to_write: &mut BTreeMap, ) { let kind_path = self.pkg_path.join(object_kind.plural_snake_case()); + let test_kind_path = self.testing_pkg_path.join(object_kind.plural_snake_case()); // (module_name, [object_name]) let mut mods = HashMap::>::new(); + let mut test_mods = HashMap::>::new(); // Generate folder contents: let ordered_objects = objects.ordered_objects(object_kind.into()); for &obj in &ordered_objects { - let filepath = kind_path.join(format!("{}.py", obj.snake_case_name())); + let filepath = if obj.is_testing() { + test_kind_path.join(format!("{}.py", obj.snake_case_name())) + } else { + kind_path.join(format!("{}.py", obj.snake_case_name())) + }; let ext_class = ExtensionClass::new(&kind_path, obj); @@ -267,9 +278,14 @@ impl PythonCodeGenerator { // NOTE: Isolating the file stem only works because we're handling datatypes, components // and archetypes separately (and even then it's a bit shady, eh). - mods.entry(filepath.file_stem().unwrap().to_owned()) - .or_default() - .extend(names.iter().cloned()); + if obj.is_testing() { + &mut test_mods + } else { + &mut mods + } + .entry(filepath.file_stem().unwrap().to_owned()) + .or_default() + .extend(names.iter().cloned()); let mut code = String::new(); code.push_text(&format!("# {}", autogen_warning!()), 1, 0); @@ -287,8 +303,11 @@ impl PythonCodeGenerator { let manifest = quote_manifest(names); + let rerun_path = if obj.is_testing() { "rerun." } else { ".." }; + code.push_unindented_text( - " + format!( + " from __future__ import annotations from typing import (Any, Dict, Iterable, Optional, Sequence, Set, Tuple, Union, @@ -300,14 +319,14 @@ impl PythonCodeGenerator { import pyarrow as pa import uuid - from .._baseclasses import ( + from {rerun_path}_baseclasses import ( Archetype, BaseExtensionType, BaseExtensionArray, BaseDelegatingExtensionType, BaseDelegatingExtensionArray ) - from .._converters import ( + from {rerun_path}_converters import ( int_or_none, float_or_none, bool_or_none, @@ -325,7 +344,8 @@ impl PythonCodeGenerator { to_np_float32, to_np_float64 ) - ", + " + ), 0, ); @@ -366,60 +386,80 @@ impl PythonCodeGenerator { } // rerun/{datatypes|components|archetypes}/__init__.py - { - let path = kind_path.join("__init__.py"); + write_init(&kind_path, &mods, files_to_write); + write_init(&test_kind_path, &test_mods, files_to_write); + } - let mut code = String::new(); + fn write_files(&self, files_to_write: &BTreeMap) { + re_tracing::profile_function!(); - let manifest = quote_manifest(mods.iter().flat_map(|(_, names)| names.iter())); + // Running `black` once for each file is very slow, so we write all + // files to a temporary folder, format it, and copy back the results. - code.push_text(&format!("# {}", autogen_warning!()), 2, 0); - code.push_unindented_text( - " - from __future__ import annotations + let tempdir = tempfile::tempdir().unwrap(); + let tempdir_path = Utf8PathBuf::try_from(tempdir.path().to_owned()).unwrap(); - ", - 0, - ); + files_to_write.par_iter().for_each(|(filepath, source)| { + let formatted_source_path = self.format_path_for_tmp_dir(filepath, &tempdir_path); + super::common::write_file(&formatted_source_path, source); + }); - for (module, names) in &mods { - let names = names.join(", "); - code.push_text(&format!("from .{module} import {names}"), 1, 0); - } + format_python_dir(&tempdir_path).unwrap(); - code.push_unindented_text(format!("\n__all__ = [{manifest}]"), 0); + // Read back and copy to the final destination: + files_to_write + .par_iter() + .for_each(|(filepath, _original_source)| { + let formatted_source_path = self.format_path_for_tmp_dir(filepath, &tempdir_path); + let formatted_source = std::fs::read_to_string(formatted_source_path).unwrap(); + super::common::write_file(filepath, &formatted_source); + }); + } - files_to_write.insert(path, code); - } + fn format_path_for_tmp_dir( + &self, + filepath: &Utf8Path, + tempdir_path: &Utf8PathBuf, + ) -> Utf8PathBuf { + // If the prefix is pkg_path, strip it, and then append to tempdir + // However, if the prefix is testing_pkg_path, strip it and insert an extra + // "testing" to avoid name collisions. + filepath.strip_prefix(&self.pkg_path).map_or_else( + |_| { + tempdir_path + .join("testing") + .join(filepath.strip_prefix(&self.testing_pkg_path).unwrap()) + }, + |f| tempdir_path.join(f), + ) } } -fn write_files(pkg_path: &Utf8Path, files_to_write: &BTreeMap) { - re_tracing::profile_function!(); - - // Running `black` once for each file is very slow, so we write all - // files to a temporary folder, format it, and copy back the results. - - let tempdir = tempfile::tempdir().unwrap(); - let tempdir_path = Utf8PathBuf::try_from(tempdir.path().to_owned()).unwrap(); - - files_to_write.par_iter().for_each(|(filepath, source)| { - let formatted_source_path = tempdir_path.join(filepath.strip_prefix(pkg_path).unwrap()); - super::common::write_file(&formatted_source_path, source); - }); - - format_python_dir(&tempdir_path).unwrap(); +fn write_init( + kind_path: &Utf8PathBuf, + mods: &HashMap>, + files_to_write: &mut BTreeMap, +) { + let path = kind_path.join("__init__.py"); + let mut code = String::new(); + let manifest = quote_manifest(mods.iter().flat_map(|(_, names)| names.iter())); + code.push_text(&format!("# {}", autogen_warning!()), 2, 0); + code.push_unindented_text( + " + from __future__ import annotations - // Read back and copy to the final destination: - files_to_write - .par_iter() - .for_each(|(filepath, _original_source)| { - let formatted_source_path = tempdir_path.join(filepath.strip_prefix(pkg_path).unwrap()); - let formatted_source = std::fs::read_to_string(formatted_source_path).unwrap(); - super::common::write_file(filepath, &formatted_source); - }); + ", + 0, + ); + for (module, names) in mods { + let names = names.join(", "); + code.push_text(&format!("from .{module} import {names}"), 1, 0); + } + code.push_unindented_text(format!("\n__all__ = [{manifest}]"), 0); + files_to_write.insert(path, code); } +#[allow(dead_code)] fn lib_source_code(archetype_names: &[String]) -> String { let manifest = quote_manifest(archetype_names); let archetype_names = archetype_names.join(", "); diff --git a/crates/re_types_builder/src/lib.rs b/crates/re_types_builder/src/lib.rs index 9d1b8c188126..f84adf81f81c 100644 --- a/crates/re_types_builder/src/lib.rs +++ b/crates/re_types_builder/src/lib.rs @@ -260,7 +260,7 @@ pub fn generate_lang_agnostic( /// Generates a .gitattributes file that marks up all generated files as generated pub fn generate_gitattributes_for_generated_files( - output_path: impl AsRef, + output_path: &impl AsRef, files: impl Iterator, ) { let filename = ".gitattributes"; @@ -311,7 +311,7 @@ pub fn generate_cpp_code( re_tracing::profile_function!(); let mut gen = CppCodeGenerator::new(output_path.as_ref()); let filepaths = gen.generate(objects, arrow_registry); - generate_gitattributes_for_generated_files(output_path, filepaths.into_iter()); + generate_gitattributes_for_generated_files(&output_path, filepaths.into_iter()); } /// Generates Rust code. @@ -340,7 +340,7 @@ pub fn generate_rust_code( re_tracing::profile_function!(); let mut gen = RustCodeGenerator::new(output_crate_path.as_ref()); let filepaths = gen.generate(objects, arrow_registry); - generate_gitattributes_for_generated_files(output_crate_path, filepaths.into_iter()); + generate_gitattributes_for_generated_files(&output_crate_path, filepaths.into_iter()); } /// Generates Python code. @@ -356,20 +356,35 @@ pub fn generate_rust_code( /// "./definitions/rerun/archetypes.fbs", /// ); /// re_types_builder::generate_python_code( -/// "./rerun_py", +/// "./rerun_py/rerun_sdk", +/// "./rerun_py/tests", /// &objects, /// &arrow_registry, /// ); /// ``` pub fn generate_python_code( output_pkg_path: impl AsRef, + testing_output_pkg_path: impl AsRef, objects: &Objects, arrow_registry: &ArrowRegistry, ) { re_tracing::profile_function!(); - let mut gen = PythonCodeGenerator::new(output_pkg_path.as_ref()); + let mut gen = + PythonCodeGenerator::new(output_pkg_path.as_ref(), testing_output_pkg_path.as_ref()); let filepaths = gen.generate(objects, arrow_registry); - generate_gitattributes_for_generated_files(output_pkg_path, filepaths.into_iter()); + generate_gitattributes_for_generated_files( + &output_pkg_path, + filepaths + .iter() + .filter(|f| f.starts_with(output_pkg_path.as_ref())) + .cloned(), + ); + generate_gitattributes_for_generated_files( + &testing_output_pkg_path, + filepaths + .into_iter() + .filter(|f| f.starts_with(testing_output_pkg_path.as_ref())), + ); } pub(crate) fn rerun_workspace_path() -> camino::Utf8PathBuf { diff --git a/examples/python/depth_guided_stable_diffusion/huggingface_pipeline.py b/examples/python/depth_guided_stable_diffusion/huggingface_pipeline.py index b5ee019e39e2..1a72d0d87c17 100644 --- a/examples/python/depth_guided_stable_diffusion/huggingface_pipeline.py +++ b/examples/python/depth_guided_stable_diffusion/huggingface_pipeline.py @@ -57,7 +57,7 @@ from transformers import DPTForDepthEstimation logger = logging.get_logger(__name__) # pylint: disable=invalid-name -logger.addHandler(rr.log.text.LoggingHandler("logs")) +logger.addHandler(rr.LoggingHandler("logs")) # Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_img2img.preprocess diff --git a/examples/python/detect_and_track_objects/main.py b/examples/python/detect_and_track_objects/main.py index fb7d4695a872..77f4c7e85011 100755 --- a/examples/python/detect_and_track_objects/main.py +++ b/examples/python/detect_and_track_objects/main.py @@ -131,7 +131,7 @@ def log_detections(self, boxes: npt.NDArray[np.float32], class_ids: list[int], t rr.log_rects( "image_scaled/detections/things", thing_boxes, - rect_format=rr.log.rects.RectFormat.XYXY, + rect_format=rr.RectFormat.XYXY, class_ids=thing_class_ids, ) @@ -140,7 +140,7 @@ def log_detections(self, boxes: npt.NDArray[np.float32], class_ids: list[int], t rr.log_rects( "image_scaled/detections/background", background_boxes, - rect_format=rr.log.rects.RectFormat.XYXY, + rect_format=rr.RectFormat.XYXY, class_ids=background_class_ids, ) @@ -191,7 +191,7 @@ def log_tracked(self) -> None: rr.log_rect( f"image/tracked/{self.tracking_id}", self.tracked.bbox_xywh, - rect_format=rr.log.rects.RectFormat.XYWH, + rect_format=rr.RectFormat.XYWH, class_id=self.tracked.class_id, ) else: @@ -312,7 +312,7 @@ def track_objects(video_path: str) -> None: with open(COCO_CATEGORIES_PATH) as f: coco_categories = json.load(f) class_descriptions = [ - rr.log.annotation.AnnotationInfo(id=cat["id"], color=cat["color"], label=cat["name"]) for cat in coco_categories + rr.AnnotationInfo(id=cat["id"], color=cat["color"], label=cat["name"]) for cat in coco_categories ] rr.log_annotation_context("/", class_descriptions, timeless=True) @@ -368,9 +368,9 @@ def get_downloaded_path(dataset_dir: Path, video_name: str) -> str: return str(destination_path) -def setup_looging() -> None: +def setup_logging() -> None: logger = logging.getLogger() - rerun_handler = rr.log.text.LoggingHandler("logs") + rerun_handler = rr.LoggingHandler("logs") rerun_handler.setLevel(-1) logger.addHandler(rerun_handler) @@ -395,7 +395,7 @@ def main() -> None: rr.script_setup(args, "rerun_example_detect_and_track_objects") - setup_looging() + setup_logging() video_path: str = args.video_path if not video_path: diff --git a/examples/python/text_logging/main.py b/examples/python/text_logging/main.py index 1afb60ef5ef5..0a1c598e0579 100755 --- a/examples/python/text_logging/main.py +++ b/examples/python/text_logging/main.py @@ -25,7 +25,7 @@ def setup_logging() -> None: # default). # # For more info: https://docs.python.org/3/howto/logging.html#handlers - logging.getLogger().addHandler(rr.log.text.LoggingHandler()) + logging.getLogger().addHandler(rr.LoggingHandler()) logging.getLogger().setLevel(-1) @@ -63,7 +63,7 @@ def log_stuff(frame_offset: int) -> None: # Use spaces to create distinct logging streams other_logger = logging.getLogger("totally.unrelated") other_logger.propagate = False # don't want root logger to catch those - other_logger.addHandler(rr.log.text.LoggingHandler("3rd_party_logs")) + other_logger.addHandler(rr.LoggingHandler("3rd_party_logs")) for _ in range(10): other_logger.debug("look ma, got my very own view!") diff --git a/rerun_py/ARCHITECTURE.md b/rerun_py/ARCHITECTURE.md index 684f6ec3cdc5..085b3e00d6c0 100644 --- a/rerun_py/ARCHITECTURE.md +++ b/rerun_py/ARCHITECTURE.md @@ -1,7 +1,5 @@ # Rerun Python SDK Architecture -**NOTE**: this document applies to the next generation, WIP API, currently residing in `rerun_sdk/rerun/_rerun2`. - ## Background Rerun primarily logs components, which are pieces of data with well-defined memory layout and semantics. For example, the `Color` component is stored as a `uint32` and represent a sRGB, RGBA color information. Components are typically logged in array form. @@ -160,7 +158,7 @@ Implementing a Pythonic API for a component or datatype sometime require a subtl The `converter` attribute of [`attrs.field()`] can be any callable. Often, `lambda` would make for a concise and efficient converter implementation, but, unfortunately, mypy doesn't support anything else than regular functions and emits error otherwise. For this reason, the code generator always uses regular functions when generating default converter. This is done by either of the following means: - using built-in function (e.g. `int()`, for non-nullable `int` fields); -- using one of the functions provided in `_rerun2/_converters.py` (e.g. `int_or_none()` for nullable `int` fields); +- using one of the functions provided in `_converters.py` (e.g. `int_or_none()` for nullable `int` fields); - locally generating a bespoke converter function (e.g. for field using datatypes, nullable or otherwise). diff --git a/rerun_py/docs/gen_common_index.py b/rerun_py/docs/gen_common_index.py index fe63e27c8b45..5035489b8d8b 100644 --- a/rerun_py/docs/gen_common_index.py +++ b/rerun_py/docs/gen_common_index.py @@ -115,7 +115,7 @@ class Section: ), Section( title="Transforms", - module_summary="log.transform", + module_summary="log_deprecated.transform", func_list=[ "log_transform3d", "log_pinhole", diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/.gitattributes b/rerun_py/rerun_sdk/rerun/.gitattributes similarity index 67% rename from rerun_py/rerun_sdk/rerun/_rerun2/.gitattributes rename to rerun_py/rerun_sdk/rerun/.gitattributes index 948966ffa017..617e08a0f991 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/.gitattributes +++ b/rerun_py/rerun_sdk/rerun/.gitattributes @@ -1,9 +1,7 @@ # DO NOT EDIT! This file is generated by crates/re_types_builder/src/lib.rs .gitattributes linguist-generated=true -__init__.py linguist-generated=true archetypes/__init__.py linguist-generated=true -archetypes/affix_fuzzer1.py linguist-generated=true archetypes/annotation_context.py linguist-generated=true archetypes/arrows3d.py linguist-generated=true archetypes/boxes2d.py linguist-generated=true @@ -22,27 +20,6 @@ archetypes/text_document.py linguist-generated=true archetypes/text_log.py linguist-generated=true archetypes/transform3d.py linguist-generated=true components/__init__.py linguist-generated=true -components/affix_fuzzer1.py linguist-generated=true -components/affix_fuzzer10.py linguist-generated=true -components/affix_fuzzer11.py linguist-generated=true -components/affix_fuzzer12.py linguist-generated=true -components/affix_fuzzer13.py linguist-generated=true -components/affix_fuzzer14.py linguist-generated=true -components/affix_fuzzer15.py linguist-generated=true -components/affix_fuzzer16.py linguist-generated=true -components/affix_fuzzer17.py linguist-generated=true -components/affix_fuzzer18.py linguist-generated=true -components/affix_fuzzer19.py linguist-generated=true -components/affix_fuzzer2.py linguist-generated=true -components/affix_fuzzer20.py linguist-generated=true -components/affix_fuzzer21.py linguist-generated=true -components/affix_fuzzer3.py linguist-generated=true -components/affix_fuzzer4.py linguist-generated=true -components/affix_fuzzer5.py linguist-generated=true -components/affix_fuzzer6.py linguist-generated=true -components/affix_fuzzer7.py linguist-generated=true -components/affix_fuzzer8.py linguist-generated=true -components/affix_fuzzer9.py linguist-generated=true components/annotation_context.py linguist-generated=true components/class_id.py linguist-generated=true components/clear_settings.py linguist-generated=true @@ -69,31 +46,21 @@ components/text_log_level.py linguist-generated=true components/transform3d.py linguist-generated=true components/vector3d.py linguist-generated=true datatypes/__init__.py linguist-generated=true -datatypes/affix_fuzzer1.py linguist-generated=true -datatypes/affix_fuzzer2.py linguist-generated=true -datatypes/affix_fuzzer20.py linguist-generated=true -datatypes/affix_fuzzer21.py linguist-generated=true -datatypes/affix_fuzzer3.py linguist-generated=true -datatypes/affix_fuzzer4.py linguist-generated=true -datatypes/affix_fuzzer5.py linguist-generated=true datatypes/angle.py linguist-generated=true datatypes/annotation_info.py linguist-generated=true datatypes/class_description.py linguist-generated=true datatypes/class_description_map_elem.py linguist-generated=true datatypes/class_id.py linguist-generated=true datatypes/color.py linguist-generated=true -datatypes/flattened_scalar.py linguist-generated=true datatypes/float32.py linguist-generated=true datatypes/keypoint_id.py linguist-generated=true datatypes/keypoint_pair.py linguist-generated=true datatypes/mat3x3.py linguist-generated=true datatypes/mat4x4.py linguist-generated=true -datatypes/primitive_component.py linguist-generated=true datatypes/quaternion.py linguist-generated=true datatypes/rotation3d.py linguist-generated=true datatypes/rotation_axis_angle.py linguist-generated=true datatypes/scale3d.py linguist-generated=true -datatypes/string_component.py linguist-generated=true datatypes/tensor_buffer.py linguist-generated=true datatypes/tensor_data.py linguist-generated=true datatypes/tensor_dimension.py linguist-generated=true diff --git a/rerun_py/rerun_sdk/rerun/__init__.py b/rerun_py/rerun_sdk/rerun/__init__.py index 0ddf54c2b4bb..7eb24a885597 100644 --- a/rerun_py/rerun_sdk/rerun/__init__.py +++ b/rerun_py/rerun_sdk/rerun/__init__.py @@ -82,7 +82,7 @@ import rerun_bindings as bindings # type: ignore[attr-defined] -from .components.transform3d import ( +from .components_deprecated.transform3d import ( Quaternion, Rigid3D, RotationAxisAngle, @@ -92,22 +92,22 @@ TranslationAndMat3, TranslationRotationScale3D, ) -from .log.annotation import AnnotationInfo, ClassDescription, log_annotation_context -from .log.arrow import log_arrow -from .log.bounding_box import log_obb, log_obbs -from .log.camera import log_pinhole -from .log.clear import log_cleared -from .log.extension_components import log_extension_components -from .log.file import ImageFormat, MeshFormat, log_image_file, log_mesh_file -from .log.image import log_depth_image, log_image, log_segmentation_image -from .log.lines import log_line_segments, log_line_strip, log_line_strips_2d, log_line_strips_3d -from .log.mesh import log_mesh, log_meshes -from .log.points import log_point, log_points -from .log.rects import RectFormat, log_rect, log_rects -from .log.scalar import log_scalar -from .log.tensor import log_tensor -from .log.text import LoggingHandler, log_text_entry -from .log.transform import ( +from .log_deprecated.annotation import AnnotationInfo, ClassDescription, log_annotation_context +from .log_deprecated.arrow import log_arrow +from .log_deprecated.bounding_box import log_obb, log_obbs +from .log_deprecated.camera import log_pinhole +from .log_deprecated.clear import log_cleared +from .log_deprecated.extension_components import log_extension_components +from .log_deprecated.file import ImageFormat, MeshFormat, log_image_file, log_mesh_file +from .log_deprecated.image import log_depth_image, log_image, log_segmentation_image +from .log_deprecated.lines import log_line_segments, log_line_strip, log_line_strips_2d, log_line_strips_3d +from .log_deprecated.mesh import log_mesh, log_meshes +from .log_deprecated.points import log_point, log_points +from .log_deprecated.rects import RectFormat, log_rect, log_rects +from .log_deprecated.scalar import log_scalar +from .log_deprecated.tensor import log_tensor +from .log_deprecated.text import LoggingHandler, log_text_entry +from .log_deprecated.transform import ( log_disconnected_space, log_rigid3, log_transform3d, @@ -162,7 +162,7 @@ def _init_recording_stream() -> None: [connect, save, disconnect, memory_recording, serve, spawn] + [set_time_sequence, set_time_seconds, set_time_nanos, reset_time] + [fn for name, fn in getmembers(sys.modules[__name__], isfunction) if name.startswith("log_")] - ) # type: ignore[no-untyped-call] + ) _init_recording_stream() diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/_baseclasses.py b/rerun_py/rerun_sdk/rerun/_baseclasses.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/_baseclasses.py rename to rerun_py/rerun_sdk/rerun/_baseclasses.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/_converters.py b/rerun_py/rerun_sdk/rerun/_converters.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/_converters.py rename to rerun_py/rerun_sdk/rerun/_converters.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/__init__.py b/rerun_py/rerun_sdk/rerun/_rerun2/__init__.py deleted file mode 100644 index 3bd7f6ad9901..000000000000 --- a/rerun_py/rerun_sdk/rerun/_rerun2/__init__.py +++ /dev/null @@ -1,45 +0,0 @@ -# DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/python.rs - -from __future__ import annotations - -__all__ = [ - "AffixFuzzer1", - "AnnotationContext", - "Arrows3D", - "Boxes2D", - "Boxes3D", - "Clear", - "DepthImage", - "DisconnectedSpace", - "Image", - "LineStrips2D", - "LineStrips3D", - "Points2D", - "Points3D", - "SegmentationImage", - "Tensor", - "TextDocument", - "TextLog", - "Transform3D", -] - -from .archetypes import ( - AffixFuzzer1, - AnnotationContext, - Arrows3D, - Boxes2D, - Boxes3D, - Clear, - DepthImage, - DisconnectedSpace, - Image, - LineStrips2D, - LineStrips3D, - Points2D, - Points3D, - SegmentationImage, - Tensor, - TextDocument, - TextLog, - Transform3D, -) diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/transform3d.py b/rerun_py/rerun_sdk/rerun/_rerun2/components/transform3d.py deleted file mode 100644 index 734ee384f14a..000000000000 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/transform3d.py +++ /dev/null @@ -1,40 +0,0 @@ -# DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/python.rs -# Based on "crates/re_types/definitions/rerun/components/transform3d.fbs". - -# You can extend this class by creating a "Transform3DExt" class in "transform3d_ext.py". - -from __future__ import annotations - -from .. import datatypes -from .._baseclasses import ( - BaseDelegatingExtensionArray, - BaseDelegatingExtensionType, -) - -__all__ = ["Transform3D", "Transform3DArray", "Transform3DType"] - - -class Transform3D(datatypes.Transform3D): - """An affine transform between two 3D spaces, represented in a given direction.""" - - # You can define your own __init__ function as a member of Transform3DExt in transform3d_ext.py - - # Note: there are no fields here because Transform3D delegates to datatypes.Transform3D - pass - - -class Transform3DType(BaseDelegatingExtensionType): - _TYPE_NAME = "rerun.components.Transform3D" - _DELEGATED_EXTENSION_TYPE = datatypes.Transform3DType - - -class Transform3DArray(BaseDelegatingExtensionArray[datatypes.Transform3DArrayLike]): - _EXTENSION_NAME = "rerun.components.Transform3D" - _EXTENSION_TYPE = Transform3DType - _DELEGATED_ARRAY_TYPE = datatypes.Transform3DArray - - -Transform3DType._ARRAY_TYPE = Transform3DArray - -# TODO(cmc): bring back registration to pyarrow once legacy types are gone -# pa.register_extension_type(Transform3DType()) diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/_unions.py b/rerun_py/rerun_sdk/rerun/_unions.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/_unions.py rename to rerun_py/rerun_sdk/rerun/_unions.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/_validators.py b/rerun_py/rerun_sdk/rerun/_validators.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/_validators.py rename to rerun_py/rerun_sdk/rerun/_validators.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/__init__.py b/rerun_py/rerun_sdk/rerun/archetypes/__init__.py similarity index 94% rename from rerun_py/rerun_sdk/rerun/_rerun2/archetypes/__init__.py rename to rerun_py/rerun_sdk/rerun/archetypes/__init__.py index d30ad204cc47..d36016f25929 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/__init__.py +++ b/rerun_py/rerun_sdk/rerun/archetypes/__init__.py @@ -2,7 +2,6 @@ from __future__ import annotations -from .affix_fuzzer1 import AffixFuzzer1 from .annotation_context import AnnotationContext from .arrows3d import Arrows3D from .boxes2d import Boxes2D @@ -22,7 +21,6 @@ from .transform3d import Transform3D __all__ = [ - "AffixFuzzer1", "AnnotationContext", "Arrows3D", "Boxes2D", diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/annotation_context.py b/rerun_py/rerun_sdk/rerun/archetypes/annotation_context.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/archetypes/annotation_context.py rename to rerun_py/rerun_sdk/rerun/archetypes/annotation_context.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/arrows3d.py b/rerun_py/rerun_sdk/rerun/archetypes/arrows3d.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/archetypes/arrows3d.py rename to rerun_py/rerun_sdk/rerun/archetypes/arrows3d.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/boxes2d.py b/rerun_py/rerun_sdk/rerun/archetypes/boxes2d.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/archetypes/boxes2d.py rename to rerun_py/rerun_sdk/rerun/archetypes/boxes2d.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/boxes2d_ext.py b/rerun_py/rerun_sdk/rerun/archetypes/boxes2d_ext.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/archetypes/boxes2d_ext.py rename to rerun_py/rerun_sdk/rerun/archetypes/boxes2d_ext.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/boxes3d.py b/rerun_py/rerun_sdk/rerun/archetypes/boxes3d.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/archetypes/boxes3d.py rename to rerun_py/rerun_sdk/rerun/archetypes/boxes3d.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/boxes3d_ext.py b/rerun_py/rerun_sdk/rerun/archetypes/boxes3d_ext.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/archetypes/boxes3d_ext.py rename to rerun_py/rerun_sdk/rerun/archetypes/boxes3d_ext.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/clear.py b/rerun_py/rerun_sdk/rerun/archetypes/clear.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/archetypes/clear.py rename to rerun_py/rerun_sdk/rerun/archetypes/clear.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/depth_image.py b/rerun_py/rerun_sdk/rerun/archetypes/depth_image.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/archetypes/depth_image.py rename to rerun_py/rerun_sdk/rerun/archetypes/depth_image.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/depth_image_ext.py b/rerun_py/rerun_sdk/rerun/archetypes/depth_image_ext.py similarity index 98% rename from rerun_py/rerun_sdk/rerun/_rerun2/archetypes/depth_image_ext.py rename to rerun_py/rerun_sdk/rerun/archetypes/depth_image_ext.py index ad1dc8de8838..e2956cdcdd3f 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/depth_image_ext.py +++ b/rerun_py/rerun_sdk/rerun/archetypes/depth_image_ext.py @@ -5,7 +5,7 @@ import numpy as np import pyarrow as pa -from rerun.log.error_utils import _send_warning +from rerun.error_utils import _send_warning from .._validators import find_non_empty_dim_indices diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/disconnected_space.py b/rerun_py/rerun_sdk/rerun/archetypes/disconnected_space.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/archetypes/disconnected_space.py rename to rerun_py/rerun_sdk/rerun/archetypes/disconnected_space.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/image.py b/rerun_py/rerun_sdk/rerun/archetypes/image.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/archetypes/image.py rename to rerun_py/rerun_sdk/rerun/archetypes/image.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/image_ext.py b/rerun_py/rerun_sdk/rerun/archetypes/image_ext.py similarity index 98% rename from rerun_py/rerun_sdk/rerun/_rerun2/archetypes/image_ext.py rename to rerun_py/rerun_sdk/rerun/archetypes/image_ext.py index 39f5c7c6ea40..648106ce4026 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/image_ext.py +++ b/rerun_py/rerun_sdk/rerun/archetypes/image_ext.py @@ -5,7 +5,7 @@ import numpy as np import pyarrow as pa -from rerun.log.error_utils import _send_warning +from rerun.error_utils import _send_warning from .._validators import find_non_empty_dim_indices diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/line_strips2d.py b/rerun_py/rerun_sdk/rerun/archetypes/line_strips2d.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/archetypes/line_strips2d.py rename to rerun_py/rerun_sdk/rerun/archetypes/line_strips2d.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/line_strips3d.py b/rerun_py/rerun_sdk/rerun/archetypes/line_strips3d.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/archetypes/line_strips3d.py rename to rerun_py/rerun_sdk/rerun/archetypes/line_strips3d.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/points2d.py b/rerun_py/rerun_sdk/rerun/archetypes/points2d.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/archetypes/points2d.py rename to rerun_py/rerun_sdk/rerun/archetypes/points2d.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/points3d.py b/rerun_py/rerun_sdk/rerun/archetypes/points3d.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/archetypes/points3d.py rename to rerun_py/rerun_sdk/rerun/archetypes/points3d.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/segmentation_image.py b/rerun_py/rerun_sdk/rerun/archetypes/segmentation_image.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/archetypes/segmentation_image.py rename to rerun_py/rerun_sdk/rerun/archetypes/segmentation_image.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/segmentation_image_ext.py b/rerun_py/rerun_sdk/rerun/archetypes/segmentation_image_ext.py similarity index 98% rename from rerun_py/rerun_sdk/rerun/_rerun2/archetypes/segmentation_image_ext.py rename to rerun_py/rerun_sdk/rerun/archetypes/segmentation_image_ext.py index f8ab555ab8d1..05efc1fafcce 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/segmentation_image_ext.py +++ b/rerun_py/rerun_sdk/rerun/archetypes/segmentation_image_ext.py @@ -5,7 +5,7 @@ import numpy as np import pyarrow as pa -from rerun.log.error_utils import _send_warning +from rerun.error_utils import _send_warning from .._validators import find_non_empty_dim_indices diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/tensor.py b/rerun_py/rerun_sdk/rerun/archetypes/tensor.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/archetypes/tensor.py rename to rerun_py/rerun_sdk/rerun/archetypes/tensor.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/text_document.py b/rerun_py/rerun_sdk/rerun/archetypes/text_document.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/archetypes/text_document.py rename to rerun_py/rerun_sdk/rerun/archetypes/text_document.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/text_log.py b/rerun_py/rerun_sdk/rerun/archetypes/text_log.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/archetypes/text_log.py rename to rerun_py/rerun_sdk/rerun/archetypes/text_log.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/transform3d.py b/rerun_py/rerun_sdk/rerun/archetypes/transform3d.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/archetypes/transform3d.py rename to rerun_py/rerun_sdk/rerun/archetypes/transform3d.py diff --git a/rerun_py/rerun_sdk/rerun/components/__init__.py b/rerun_py/rerun_sdk/rerun/components/__init__.py index 755631096f3a..071b43c8072d 100644 --- a/rerun_py/rerun_sdk/rerun/components/__init__.py +++ b/rerun_py/rerun_sdk/rerun/components/__init__.py @@ -1,109 +1,143 @@ -"""The components package defines Python wrapper types for common registered Rerun components.""" -from __future__ import annotations - -from typing import Any, Final, Type, cast +# DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/python.rs -import pyarrow as pa - -from rerun import bindings +from __future__ import annotations -all = [ - "box", - "experimental", - "pinhole", - "quaternion", - "rect2d", - "scalar_plot_props", - "scalar", - "splat", - "tensor", - "vec", +from .annotation_context import ( + AnnotationContext, + AnnotationContextArray, + AnnotationContextArrayLike, + AnnotationContextLike, + AnnotationContextType, +) +from .class_id import ClassId, ClassIdArray, ClassIdType +from .clear_settings import ( + ClearSettings, + ClearSettingsArray, + ClearSettingsArrayLike, + ClearSettingsLike, + ClearSettingsType, +) +from .color import Color, ColorArray, ColorType +from .depth_meter import DepthMeter, DepthMeterArray, DepthMeterArrayLike, DepthMeterLike, DepthMeterType +from .disconnected_space import ( + DisconnectedSpace, + DisconnectedSpaceArray, + DisconnectedSpaceArrayLike, + DisconnectedSpaceLike, + DisconnectedSpaceType, +) +from .draw_order import DrawOrder, DrawOrderArray, DrawOrderArrayLike, DrawOrderLike, DrawOrderType +from .half_sizes2d import HalfSizes2D, HalfSizes2DArray, HalfSizes2DType +from .half_sizes3d import HalfSizes3D, HalfSizes3DArray, HalfSizes3DType +from .instance_key import InstanceKey, InstanceKeyArray, InstanceKeyArrayLike, InstanceKeyLike, InstanceKeyType +from .keypoint_id import KeypointId, KeypointIdArray, KeypointIdType +from .line_strip2d import LineStrip2D, LineStrip2DArray, LineStrip2DArrayLike, LineStrip2DLike, LineStrip2DType +from .line_strip3d import LineStrip3D, LineStrip3DArray, LineStrip3DArrayLike, LineStrip3DLike, LineStrip3DType +from .media_type import MediaType, MediaTypeArray, MediaTypeType +from .origin2d import Origin2D, Origin2DArray, Origin2DType +from .origin3d import Origin3D, Origin3DArray, Origin3DType +from .position2d import Position2D, Position2DArray, Position2DType +from .position3d import Position3D, Position3DArray, Position3DType +from .radius import Radius, RadiusArray, RadiusArrayLike, RadiusLike, RadiusType +from .rotation3d import Rotation3D, Rotation3DArray, Rotation3DType +from .tensor_data import TensorData, TensorDataArray, TensorDataType +from .text import Text, TextArray, TextType +from .text_log_level import TextLogLevel, TextLogLevelArray, TextLogLevelType +from .transform3d import Transform3D, Transform3DArray, Transform3DType +from .vector3d import Vector3D, Vector3DArray, Vector3DType + +__all__ = [ + "AnnotationContext", + "AnnotationContextArray", + "AnnotationContextArrayLike", + "AnnotationContextLike", + "AnnotationContextType", + "ClassId", + "ClassIdArray", + "ClassIdType", + "ClearSettings", + "ClearSettingsArray", + "ClearSettingsArrayLike", + "ClearSettingsLike", + "ClearSettingsType", + "Color", + "ColorArray", + "ColorType", + "DepthMeter", + "DepthMeterArray", + "DepthMeterArrayLike", + "DepthMeterLike", + "DepthMeterType", + "DisconnectedSpace", + "DisconnectedSpaceArray", + "DisconnectedSpaceArrayLike", + "DisconnectedSpaceLike", + "DisconnectedSpaceType", + "DrawOrder", + "DrawOrderArray", + "DrawOrderArrayLike", + "DrawOrderLike", + "DrawOrderType", + "HalfSizes2D", + "HalfSizes2DArray", + "HalfSizes2DType", + "HalfSizes3D", + "HalfSizes3DArray", + "HalfSizes3DType", + "InstanceKey", + "InstanceKeyArray", + "InstanceKeyArrayLike", + "InstanceKeyLike", + "InstanceKeyType", + "KeypointId", + "KeypointIdArray", + "KeypointIdType", + "LineStrip2D", + "LineStrip2DArray", + "LineStrip2DArrayLike", + "LineStrip2DLike", + "LineStrip2DType", + "LineStrip3D", + "LineStrip3DArray", + "LineStrip3DArrayLike", + "LineStrip3DLike", + "LineStrip3DType", + "MediaType", + "MediaTypeArray", + "MediaTypeType", + "Origin2D", + "Origin2DArray", + "Origin2DType", + "Origin3D", + "Origin3DArray", + "Origin3DType", + "Position2D", + "Position2DArray", + "Position2DType", + "Position3D", + "Position3DArray", + "Position3DType", + "Radius", + "RadiusArray", + "RadiusArrayLike", + "RadiusLike", + "RadiusType", + "Rotation3D", + "Rotation3DArray", + "Rotation3DType", + "TensorData", + "TensorDataArray", + "TensorDataType", + "Text", + "TextArray", + "TextLogLevel", + "TextLogLevelArray", + "TextLogLevelType", + "TextType", + "Transform3D", + "Transform3DArray", + "Transform3DType", + "Vector3D", + "Vector3DArray", + "Vector3DType", ] - -# Component names that are recognized by Rerun. -REGISTERED_COMPONENT_NAMES: Final[dict[str, pa.field]] = bindings.get_registered_component_names() - - -def ComponentTypeFactory(name: str, array_cls: type[pa.ExtensionArray], field: pa.Field) -> type[pa.ExtensionType]: - """Build a component type wrapper.""" - - def __init__(self: type[pa.ExtensionType]) -> None: - pa.ExtensionType.__init__(self, self.storage_type, field.name) - - def __arrow_ext_serialize__(self: type[pa.ExtensionType]) -> bytes: - return b"" - - @classmethod # type: ignore[misc] - def __arrow_ext_deserialize__( - cls: type[pa.ExtensionType], storage_type: Any, serialized: Any - ) -> type[pa.ExtensionType]: - """Return an instance of this subclass given the serialized metadata.""" - return cast(Type[pa.ExtensionType], cls()) - - def __arrow_ext_class__(self: type[pa.ExtensionType]) -> type[pa.ExtensionArray]: - return array_cls - - component_type = type( - name, - (pa.ExtensionType,), - { - "storage_type": field.type, - "__init__": __init__, - "__arrow_ext_serialize__": __arrow_ext_serialize__, - "__arrow_ext_deserialize__": __arrow_ext_deserialize__, - "__arrow_ext_class__": __arrow_ext_class__, - }, - ) - - return cast(Type[pa.ExtensionType], component_type) - - -def union_discriminant_type(data_type: pa.DenseUnionType, discriminant: str) -> pa.DataType: - """Return the data type of the given discriminant.""" - return next(f.type for f in list(data_type) if f.name == discriminant) - - -def build_dense_union(data_type: pa.DenseUnionType, discriminant: str, child: pa.Array) -> pa.UnionArray: - """ - Build a dense UnionArray given the `data_type`, a discriminant, and the child value array. - - If the discriminant string doesn't match any possible value, a `ValueError` is raised. - - WARNING: Because of #705, each new union component needs to be handled in `array_to_rust` on the native side. - """ - try: - idx = [f.name for f in list(data_type)].index(discriminant) - type_ids = pa.array([idx] * len(child), type=pa.int8()) - value_offsets = pa.array(range(len(child)), type=pa.int32()) - - children = [pa.nulls(0, type=f.type) for f in list(data_type)] - try: - children[idx] = child.cast(data_type[idx].type, safe=False) - except pa.ArrowInvalid: - # Since we're having issues with nullability in union types (see below), - # the cast sometimes fails but can be skipped. - children[idx] = child - - return pa.Array.from_buffers( - type=data_type, - length=len(child), - buffers=[None, type_ids.buffers()[1], value_offsets.buffers()[1]], - children=children, - ) - # Cast doesn't work for non-flat unions it seems - we're getting issues about the nullability of union variants. - # It's pointless anyways since on the native side we have to cast the field types - # See https://github.com/rerun-io/rerun/issues/795 - # .cast(data_type) - - except ValueError as e: - raise ValueError(e.args) - - -# NOTE: This has to live here for now, while we migrate to archetypes (circular experimental imports). -def instance_key_splat() -> Any: - """Helper to generate a splat InstanceKeyArray.""" - - from rerun.experimental import cmp as rrc - - _MAX_U64 = 2**64 - 1 - return pa.array([_MAX_U64], type=rrc.InstanceKeyType().storage_type) # type: ignore[no-any-return] diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/annotation_context.py b/rerun_py/rerun_sdk/rerun/components/annotation_context.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/annotation_context.py rename to rerun_py/rerun_sdk/rerun/components/annotation_context.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/annotation_context_ext.py b/rerun_py/rerun_sdk/rerun/components/annotation_context_ext.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/annotation_context_ext.py rename to rerun_py/rerun_sdk/rerun/components/annotation_context_ext.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/class_id.py b/rerun_py/rerun_sdk/rerun/components/class_id.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/class_id.py rename to rerun_py/rerun_sdk/rerun/components/class_id.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/clear_settings.py b/rerun_py/rerun_sdk/rerun/components/clear_settings.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/clear_settings.py rename to rerun_py/rerun_sdk/rerun/components/clear_settings.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/clear_settings_ext.py b/rerun_py/rerun_sdk/rerun/components/clear_settings_ext.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/clear_settings_ext.py rename to rerun_py/rerun_sdk/rerun/components/clear_settings_ext.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/color.py b/rerun_py/rerun_sdk/rerun/components/color.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/color.py rename to rerun_py/rerun_sdk/rerun/components/color.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/depth_meter.py b/rerun_py/rerun_sdk/rerun/components/depth_meter.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/depth_meter.py rename to rerun_py/rerun_sdk/rerun/components/depth_meter.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/depth_meter_ext.py b/rerun_py/rerun_sdk/rerun/components/depth_meter_ext.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/depth_meter_ext.py rename to rerun_py/rerun_sdk/rerun/components/depth_meter_ext.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/disconnected_space.py b/rerun_py/rerun_sdk/rerun/components/disconnected_space.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/disconnected_space.py rename to rerun_py/rerun_sdk/rerun/components/disconnected_space.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/disconnected_space_ext.py b/rerun_py/rerun_sdk/rerun/components/disconnected_space_ext.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/disconnected_space_ext.py rename to rerun_py/rerun_sdk/rerun/components/disconnected_space_ext.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/draw_order.py b/rerun_py/rerun_sdk/rerun/components/draw_order.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/draw_order.py rename to rerun_py/rerun_sdk/rerun/components/draw_order.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/draw_order_ext.py b/rerun_py/rerun_sdk/rerun/components/draw_order_ext.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/draw_order_ext.py rename to rerun_py/rerun_sdk/rerun/components/draw_order_ext.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/half_sizes2d.py b/rerun_py/rerun_sdk/rerun/components/half_sizes2d.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/half_sizes2d.py rename to rerun_py/rerun_sdk/rerun/components/half_sizes2d.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/half_sizes3d.py b/rerun_py/rerun_sdk/rerun/components/half_sizes3d.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/half_sizes3d.py rename to rerun_py/rerun_sdk/rerun/components/half_sizes3d.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/instance_key.py b/rerun_py/rerun_sdk/rerun/components/instance_key.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/instance_key.py rename to rerun_py/rerun_sdk/rerun/components/instance_key.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/instance_key_ext.py b/rerun_py/rerun_sdk/rerun/components/instance_key_ext.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/instance_key_ext.py rename to rerun_py/rerun_sdk/rerun/components/instance_key_ext.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/keypoint_id.py b/rerun_py/rerun_sdk/rerun/components/keypoint_id.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/keypoint_id.py rename to rerun_py/rerun_sdk/rerun/components/keypoint_id.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/line_strip2d.py b/rerun_py/rerun_sdk/rerun/components/line_strip2d.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/line_strip2d.py rename to rerun_py/rerun_sdk/rerun/components/line_strip2d.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/line_strip2d_ext.py b/rerun_py/rerun_sdk/rerun/components/line_strip2d_ext.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/line_strip2d_ext.py rename to rerun_py/rerun_sdk/rerun/components/line_strip2d_ext.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/line_strip3d.py b/rerun_py/rerun_sdk/rerun/components/line_strip3d.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/line_strip3d.py rename to rerun_py/rerun_sdk/rerun/components/line_strip3d.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/line_strip3d_ext.py b/rerun_py/rerun_sdk/rerun/components/line_strip3d_ext.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/line_strip3d_ext.py rename to rerun_py/rerun_sdk/rerun/components/line_strip3d_ext.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/media_type.py b/rerun_py/rerun_sdk/rerun/components/media_type.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/media_type.py rename to rerun_py/rerun_sdk/rerun/components/media_type.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/origin2d.py b/rerun_py/rerun_sdk/rerun/components/origin2d.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/origin2d.py rename to rerun_py/rerun_sdk/rerun/components/origin2d.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/origin3d.py b/rerun_py/rerun_sdk/rerun/components/origin3d.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/origin3d.py rename to rerun_py/rerun_sdk/rerun/components/origin3d.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/position2d.py b/rerun_py/rerun_sdk/rerun/components/position2d.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/position2d.py rename to rerun_py/rerun_sdk/rerun/components/position2d.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/position3d.py b/rerun_py/rerun_sdk/rerun/components/position3d.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/position3d.py rename to rerun_py/rerun_sdk/rerun/components/position3d.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/radius.py b/rerun_py/rerun_sdk/rerun/components/radius.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/radius.py rename to rerun_py/rerun_sdk/rerun/components/radius.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/radius_ext.py b/rerun_py/rerun_sdk/rerun/components/radius_ext.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/radius_ext.py rename to rerun_py/rerun_sdk/rerun/components/radius_ext.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/rotation3d.py b/rerun_py/rerun_sdk/rerun/components/rotation3d.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/rotation3d.py rename to rerun_py/rerun_sdk/rerun/components/rotation3d.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/tensor_data.py b/rerun_py/rerun_sdk/rerun/components/tensor_data.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/tensor_data.py rename to rerun_py/rerun_sdk/rerun/components/tensor_data.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/text.py b/rerun_py/rerun_sdk/rerun/components/text.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/text.py rename to rerun_py/rerun_sdk/rerun/components/text.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/text_log_level.py b/rerun_py/rerun_sdk/rerun/components/text_log_level.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/text_log_level.py rename to rerun_py/rerun_sdk/rerun/components/text_log_level.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/text_log_level_ext.py b/rerun_py/rerun_sdk/rerun/components/text_log_level_ext.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/text_log_level_ext.py rename to rerun_py/rerun_sdk/rerun/components/text_log_level_ext.py diff --git a/rerun_py/rerun_sdk/rerun/components/transform3d.py b/rerun_py/rerun_sdk/rerun/components/transform3d.py index 56d2c2c90577..734ee384f14a 100644 --- a/rerun_py/rerun_sdk/rerun/components/transform3d.py +++ b/rerun_py/rerun_sdk/rerun/components/transform3d.py @@ -1,101 +1,40 @@ -from __future__ import annotations +# DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/python.rs +# Based on "crates/re_types/definitions/rerun/components/transform3d.fbs". -from dataclasses import dataclass +# You can extend this class by creating a "Transform3DExt" class in "transform3d_ext.py". -import numpy.typing as npt +from __future__ import annotations -from rerun.components.quaternion import Quaternion +from .. import datatypes +from .._baseclasses import ( + BaseDelegatingExtensionArray, + BaseDelegatingExtensionType, +) -__all__ = [ - "Quaternion", - "Rigid3D", - "RotationAxisAngle", - "Scale3D", - "Transform3D", - "Translation3D", - "TranslationAndMat3", - "TranslationRotationScale3D", -] +__all__ = ["Transform3D", "Transform3DArray", "Transform3DType"] -@dataclass -class Transform3D: +class Transform3D(datatypes.Transform3D): """An affine transform between two 3D spaces, represented in a given direction.""" - transform: TranslationAndMat3 | TranslationRotationScale3D - """Representation of a 3D transform.""" - - from_parent: bool = False - """ - If True, the transform maps from the parent space to the child space. - Otherwise, the transform maps from the child space to the parent space. - """ - - -@dataclass -class TranslationAndMat3: - """Representation of a affine transform via a 3x3 translation matrix paired with a translation.""" - - translation: npt.ArrayLike | Translation3D | None = None - """3D translation vector, applied after the matrix. Uses (0, 0, 0) if not set.""" - - matrix: npt.ArrayLike | None = None - """The row-major 3x3 matrix for scale, rotation & skew matrix. Uses identity if not set.""" - - -@dataclass -class Rigid3D: - """Representation of a rigid transform via separate translation & rotation.""" - - translation: Translation3D | npt.ArrayLike | None = None - """3D translation vector, applied last.""" - - rotation: Quaternion | RotationAxisAngle | None = None - """3D rotation, represented as a quaternion or axis + angle, applied second.""" - - -@dataclass -class TranslationRotationScale3D: - """Representation of an affine transform via separate translation, rotation & scale.""" - - translation: Translation3D | npt.ArrayLike | None = None - """3D translation vector, applied last.""" - - rotation: Quaternion | RotationAxisAngle | None = None - """3D rotation, represented as a quaternion or axis + angle, applied second.""" - - scale: Scale3D | npt.ArrayLike | float | None = None - """3D scaling either a 3D vector, scalar or None. Applied first.""" - - -@dataclass -class Translation3D: - """3D translation expressed as a vector.""" - - translation: npt.ArrayLike - + # You can define your own __init__ function as a member of Transform3DExt in transform3d_ext.py -@dataclass -class Scale3D: - """3D scale expressed as either a uniform scale or a vector.""" + # Note: there are no fields here because Transform3D delegates to datatypes.Transform3D + pass - scale: npt.ArrayLike | float +class Transform3DType(BaseDelegatingExtensionType): + _TYPE_NAME = "rerun.components.Transform3D" + _DELEGATED_EXTENSION_TYPE = datatypes.Transform3DType -@dataclass -class RotationAxisAngle: - """3D rotation expressed via a rotation axis and angle.""" - axis: npt.ArrayLike - """ - Axis to rotate around. +class Transform3DArray(BaseDelegatingExtensionArray[datatypes.Transform3DArrayLike]): + _EXTENSION_NAME = "rerun.components.Transform3D" + _EXTENSION_TYPE = Transform3DType + _DELEGATED_ARRAY_TYPE = datatypes.Transform3DArray - This is not required to be normalized. - If normalization fails (typically because the vector is length zero), the rotation is silently ignored. - """ - degrees: float | None = None - """3D rotation angle in degrees. Only one of `degrees` or `radians` should be set.""" +Transform3DType._ARRAY_TYPE = Transform3DArray - radians: float | None = None - """3D rotation angle in radians. Only one of `degrees` or `radians` should be set.""" +# TODO(cmc): bring back registration to pyarrow once legacy types are gone +# pa.register_extension_type(Transform3DType()) diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/vector3d.py b/rerun_py/rerun_sdk/rerun/components/vector3d.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/vector3d.py rename to rerun_py/rerun_sdk/rerun/components/vector3d.py diff --git a/rerun_py/rerun_sdk/rerun/components_deprecated/__init__.py b/rerun_py/rerun_sdk/rerun/components_deprecated/__init__.py new file mode 100644 index 000000000000..755631096f3a --- /dev/null +++ b/rerun_py/rerun_sdk/rerun/components_deprecated/__init__.py @@ -0,0 +1,109 @@ +"""The components package defines Python wrapper types for common registered Rerun components.""" +from __future__ import annotations + +from typing import Any, Final, Type, cast + +import pyarrow as pa + +from rerun import bindings + +all = [ + "box", + "experimental", + "pinhole", + "quaternion", + "rect2d", + "scalar_plot_props", + "scalar", + "splat", + "tensor", + "vec", +] + +# Component names that are recognized by Rerun. +REGISTERED_COMPONENT_NAMES: Final[dict[str, pa.field]] = bindings.get_registered_component_names() + + +def ComponentTypeFactory(name: str, array_cls: type[pa.ExtensionArray], field: pa.Field) -> type[pa.ExtensionType]: + """Build a component type wrapper.""" + + def __init__(self: type[pa.ExtensionType]) -> None: + pa.ExtensionType.__init__(self, self.storage_type, field.name) + + def __arrow_ext_serialize__(self: type[pa.ExtensionType]) -> bytes: + return b"" + + @classmethod # type: ignore[misc] + def __arrow_ext_deserialize__( + cls: type[pa.ExtensionType], storage_type: Any, serialized: Any + ) -> type[pa.ExtensionType]: + """Return an instance of this subclass given the serialized metadata.""" + return cast(Type[pa.ExtensionType], cls()) + + def __arrow_ext_class__(self: type[pa.ExtensionType]) -> type[pa.ExtensionArray]: + return array_cls + + component_type = type( + name, + (pa.ExtensionType,), + { + "storage_type": field.type, + "__init__": __init__, + "__arrow_ext_serialize__": __arrow_ext_serialize__, + "__arrow_ext_deserialize__": __arrow_ext_deserialize__, + "__arrow_ext_class__": __arrow_ext_class__, + }, + ) + + return cast(Type[pa.ExtensionType], component_type) + + +def union_discriminant_type(data_type: pa.DenseUnionType, discriminant: str) -> pa.DataType: + """Return the data type of the given discriminant.""" + return next(f.type for f in list(data_type) if f.name == discriminant) + + +def build_dense_union(data_type: pa.DenseUnionType, discriminant: str, child: pa.Array) -> pa.UnionArray: + """ + Build a dense UnionArray given the `data_type`, a discriminant, and the child value array. + + If the discriminant string doesn't match any possible value, a `ValueError` is raised. + + WARNING: Because of #705, each new union component needs to be handled in `array_to_rust` on the native side. + """ + try: + idx = [f.name for f in list(data_type)].index(discriminant) + type_ids = pa.array([idx] * len(child), type=pa.int8()) + value_offsets = pa.array(range(len(child)), type=pa.int32()) + + children = [pa.nulls(0, type=f.type) for f in list(data_type)] + try: + children[idx] = child.cast(data_type[idx].type, safe=False) + except pa.ArrowInvalid: + # Since we're having issues with nullability in union types (see below), + # the cast sometimes fails but can be skipped. + children[idx] = child + + return pa.Array.from_buffers( + type=data_type, + length=len(child), + buffers=[None, type_ids.buffers()[1], value_offsets.buffers()[1]], + children=children, + ) + # Cast doesn't work for non-flat unions it seems - we're getting issues about the nullability of union variants. + # It's pointless anyways since on the native side we have to cast the field types + # See https://github.com/rerun-io/rerun/issues/795 + # .cast(data_type) + + except ValueError as e: + raise ValueError(e.args) + + +# NOTE: This has to live here for now, while we migrate to archetypes (circular experimental imports). +def instance_key_splat() -> Any: + """Helper to generate a splat InstanceKeyArray.""" + + from rerun.experimental import cmp as rrc + + _MAX_U64 = 2**64 - 1 + return pa.array([_MAX_U64], type=rrc.InstanceKeyType().storage_type) # type: ignore[no-any-return] diff --git a/rerun_py/rerun_sdk/rerun/components/box.py b/rerun_py/rerun_sdk/rerun/components_deprecated/box.py similarity index 90% rename from rerun_py/rerun_sdk/rerun/components/box.py rename to rerun_py/rerun_sdk/rerun/components_deprecated/box.py index 31fc87f39ec6..3c46ea8424a3 100644 --- a/rerun_py/rerun_sdk/rerun/components/box.py +++ b/rerun_py/rerun_sdk/rerun/components_deprecated/box.py @@ -4,7 +4,7 @@ import numpy.typing as npt import pyarrow as pa -from rerun.components import REGISTERED_COMPONENT_NAMES, ComponentTypeFactory +from rerun.components_deprecated import REGISTERED_COMPONENT_NAMES, ComponentTypeFactory __all__ = [ "Box3DArray", diff --git a/rerun_py/rerun_sdk/rerun/components/experimental/__init__.py b/rerun_py/rerun_sdk/rerun/components_deprecated/experimental/__init__.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/components/experimental/__init__.py rename to rerun_py/rerun_sdk/rerun/components_deprecated/experimental/__init__.py diff --git a/rerun_py/rerun_sdk/rerun/components/pinhole.py b/rerun_py/rerun_sdk/rerun/components_deprecated/pinhole.py similarity index 91% rename from rerun_py/rerun_sdk/rerun/components/pinhole.py rename to rerun_py/rerun_sdk/rerun/components_deprecated/pinhole.py index dc1a423cc8e3..9da65e1f3402 100644 --- a/rerun_py/rerun_sdk/rerun/components/pinhole.py +++ b/rerun_py/rerun_sdk/rerun/components_deprecated/pinhole.py @@ -6,8 +6,8 @@ import numpy.typing as npt import pyarrow as pa -from rerun.components import REGISTERED_COMPONENT_NAMES, ComponentTypeFactory -from rerun.log import _normalize_matrix3 +from rerun.components_deprecated import REGISTERED_COMPONENT_NAMES, ComponentTypeFactory +from rerun.log_deprecated import _normalize_matrix3 __all__ = [ "PinholeArray", diff --git a/rerun_py/rerun_sdk/rerun/components/quaternion.py b/rerun_py/rerun_sdk/rerun/components_deprecated/quaternion.py similarity index 93% rename from rerun_py/rerun_sdk/rerun/components/quaternion.py rename to rerun_py/rerun_sdk/rerun/components_deprecated/quaternion.py index e6c0b5cb705e..bedb77756865 100644 --- a/rerun_py/rerun_sdk/rerun/components/quaternion.py +++ b/rerun_py/rerun_sdk/rerun/components_deprecated/quaternion.py @@ -4,7 +4,7 @@ import numpy.typing as npt import pyarrow as pa -from rerun.components import REGISTERED_COMPONENT_NAMES, ComponentTypeFactory +from rerun.components_deprecated import REGISTERED_COMPONENT_NAMES, ComponentTypeFactory __all__ = ["QuaternionArray", "QuaternionType", "Quaternion"] diff --git a/rerun_py/rerun_sdk/rerun/components/rect2d.py b/rerun_py/rerun_sdk/rerun/components_deprecated/rect2d.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/components/rect2d.py rename to rerun_py/rerun_sdk/rerun/components_deprecated/rect2d.py diff --git a/rerun_py/rerun_sdk/rerun/components/scalar.py b/rerun_py/rerun_sdk/rerun/components_deprecated/scalar.py similarity index 94% rename from rerun_py/rerun_sdk/rerun/components/scalar.py rename to rerun_py/rerun_sdk/rerun/components_deprecated/scalar.py index 4f14f37e4e63..dffb716d9c27 100644 --- a/rerun_py/rerun_sdk/rerun/components/scalar.py +++ b/rerun_py/rerun_sdk/rerun/components_deprecated/scalar.py @@ -6,7 +6,7 @@ import numpy.typing as npt import pyarrow as pa -from rerun.components import REGISTERED_COMPONENT_NAMES, ComponentTypeFactory +from rerun.components_deprecated import REGISTERED_COMPONENT_NAMES, ComponentTypeFactory __all__ = [ "ScalarArray", diff --git a/rerun_py/rerun_sdk/rerun/components_deprecated/transform3d.py b/rerun_py/rerun_sdk/rerun/components_deprecated/transform3d.py new file mode 100644 index 000000000000..ee6b372ca8c8 --- /dev/null +++ b/rerun_py/rerun_sdk/rerun/components_deprecated/transform3d.py @@ -0,0 +1,101 @@ +from __future__ import annotations + +from dataclasses import dataclass + +import numpy.typing as npt + +from rerun.components_deprecated.quaternion import Quaternion + +__all__ = [ + "Quaternion", + "Rigid3D", + "RotationAxisAngle", + "Scale3D", + "Transform3D", + "Translation3D", + "TranslationAndMat3", + "TranslationRotationScale3D", +] + + +@dataclass +class Transform3D: + """An affine transform between two 3D spaces, represented in a given direction.""" + + transform: TranslationAndMat3 | TranslationRotationScale3D + """Representation of a 3D transform.""" + + from_parent: bool = False + """ + If True, the transform maps from the parent space to the child space. + Otherwise, the transform maps from the child space to the parent space. + """ + + +@dataclass +class TranslationAndMat3: + """Representation of a affine transform via a 3x3 translation matrix paired with a translation.""" + + translation: npt.ArrayLike | Translation3D | None = None + """3D translation vector, applied after the matrix. Uses (0, 0, 0) if not set.""" + + matrix: npt.ArrayLike | None = None + """The row-major 3x3 matrix for scale, rotation & skew matrix. Uses identity if not set.""" + + +@dataclass +class Rigid3D: + """Representation of a rigid transform via separate translation & rotation.""" + + translation: Translation3D | npt.ArrayLike | None = None + """3D translation vector, applied last.""" + + rotation: Quaternion | RotationAxisAngle | None = None + """3D rotation, represented as a quaternion or axis + angle, applied second.""" + + +@dataclass +class TranslationRotationScale3D: + """Representation of an affine transform via separate translation, rotation & scale.""" + + translation: Translation3D | npt.ArrayLike | None = None + """3D translation vector, applied last.""" + + rotation: Quaternion | RotationAxisAngle | None = None + """3D rotation, represented as a quaternion or axis + angle, applied second.""" + + scale: Scale3D | npt.ArrayLike | float | None = None + """3D scaling either a 3D vector, scalar or None. Applied first.""" + + +@dataclass +class Translation3D: + """3D translation expressed as a vector.""" + + translation: npt.ArrayLike + + +@dataclass +class Scale3D: + """3D scale expressed as either a uniform scale or a vector.""" + + scale: npt.ArrayLike | float + + +@dataclass +class RotationAxisAngle: + """3D rotation expressed via a rotation axis and angle.""" + + axis: npt.ArrayLike + """ + Axis to rotate around. + + This is not required to be normalized. + If normalization fails (typically because the vector is length zero), the rotation is silently ignored. + """ + + degrees: float | None = None + """3D rotation angle in degrees. Only one of `degrees` or `radians` should be set.""" + + radians: float | None = None + """3D rotation angle in radians. Only one of `degrees` or `radians` should be set.""" diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/__init__.py b/rerun_py/rerun_sdk/rerun/datatypes/__init__.py similarity index 68% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/__init__.py rename to rerun_py/rerun_sdk/rerun/datatypes/__init__.py index ade90cd80d28..ad0258ce6ebe 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/__init__.py +++ b/rerun_py/rerun_sdk/rerun/datatypes/__init__.py @@ -2,25 +2,6 @@ from __future__ import annotations -from .affix_fuzzer1 import AffixFuzzer1, AffixFuzzer1Array, AffixFuzzer1ArrayLike, AffixFuzzer1Like, AffixFuzzer1Type -from .affix_fuzzer2 import AffixFuzzer2, AffixFuzzer2Array, AffixFuzzer2ArrayLike, AffixFuzzer2Like, AffixFuzzer2Type -from .affix_fuzzer3 import AffixFuzzer3, AffixFuzzer3Array, AffixFuzzer3ArrayLike, AffixFuzzer3Like, AffixFuzzer3Type -from .affix_fuzzer4 import AffixFuzzer4, AffixFuzzer4Array, AffixFuzzer4ArrayLike, AffixFuzzer4Like, AffixFuzzer4Type -from .affix_fuzzer5 import AffixFuzzer5, AffixFuzzer5Array, AffixFuzzer5ArrayLike, AffixFuzzer5Like, AffixFuzzer5Type -from .affix_fuzzer20 import ( - AffixFuzzer20, - AffixFuzzer20Array, - AffixFuzzer20ArrayLike, - AffixFuzzer20Like, - AffixFuzzer20Type, -) -from .affix_fuzzer21 import ( - AffixFuzzer21, - AffixFuzzer21Array, - AffixFuzzer21ArrayLike, - AffixFuzzer21Like, - AffixFuzzer21Type, -) from .angle import Angle, AngleArray, AngleArrayLike, AngleLike, AngleType from .annotation_info import ( AnnotationInfo, @@ -45,25 +26,11 @@ ) from .class_id import ClassId, ClassIdArray, ClassIdArrayLike, ClassIdLike, ClassIdType from .color import Color, ColorArray, ColorArrayLike, ColorLike, ColorType -from .flattened_scalar import ( - FlattenedScalar, - FlattenedScalarArray, - FlattenedScalarArrayLike, - FlattenedScalarLike, - FlattenedScalarType, -) from .float32 import Float32, Float32Array, Float32ArrayLike, Float32Like, Float32Type from .keypoint_id import KeypointId, KeypointIdArray, KeypointIdArrayLike, KeypointIdLike, KeypointIdType from .keypoint_pair import KeypointPair, KeypointPairArray, KeypointPairArrayLike, KeypointPairLike, KeypointPairType from .mat3x3 import Mat3x3, Mat3x3Array, Mat3x3ArrayLike, Mat3x3Like, Mat3x3Type from .mat4x4 import Mat4x4, Mat4x4Array, Mat4x4ArrayLike, Mat4x4Like, Mat4x4Type -from .primitive_component import ( - PrimitiveComponent, - PrimitiveComponentArray, - PrimitiveComponentArrayLike, - PrimitiveComponentLike, - PrimitiveComponentType, -) from .quaternion import Quaternion, QuaternionArray, QuaternionArrayLike, QuaternionLike, QuaternionType from .rotation3d import Rotation3D, Rotation3DArray, Rotation3DArrayLike, Rotation3DLike, Rotation3DType from .rotation_axis_angle import ( @@ -74,13 +41,6 @@ RotationAxisAngleType, ) from .scale3d import Scale3D, Scale3DArray, Scale3DArrayLike, Scale3DLike, Scale3DType -from .string_component import ( - StringComponent, - StringComponentArray, - StringComponentArrayLike, - StringComponentLike, - StringComponentType, -) from .tensor_buffer import TensorBuffer, TensorBufferArray, TensorBufferArrayLike, TensorBufferLike, TensorBufferType from .tensor_data import TensorData, TensorDataArray, TensorDataArrayLike, TensorDataLike, TensorDataType from .tensor_dimension import ( @@ -111,41 +71,6 @@ from .vec4d import Vec4D, Vec4DArray, Vec4DArrayLike, Vec4DLike, Vec4DType __all__ = [ - "AffixFuzzer1", - "AffixFuzzer1Array", - "AffixFuzzer1ArrayLike", - "AffixFuzzer1Like", - "AffixFuzzer1Type", - "AffixFuzzer2", - "AffixFuzzer20", - "AffixFuzzer20Array", - "AffixFuzzer20ArrayLike", - "AffixFuzzer20Like", - "AffixFuzzer20Type", - "AffixFuzzer21", - "AffixFuzzer21Array", - "AffixFuzzer21ArrayLike", - "AffixFuzzer21Like", - "AffixFuzzer21Type", - "AffixFuzzer2Array", - "AffixFuzzer2ArrayLike", - "AffixFuzzer2Like", - "AffixFuzzer2Type", - "AffixFuzzer3", - "AffixFuzzer3Array", - "AffixFuzzer3ArrayLike", - "AffixFuzzer3Like", - "AffixFuzzer3Type", - "AffixFuzzer4", - "AffixFuzzer4Array", - "AffixFuzzer4ArrayLike", - "AffixFuzzer4Like", - "AffixFuzzer4Type", - "AffixFuzzer5", - "AffixFuzzer5Array", - "AffixFuzzer5ArrayLike", - "AffixFuzzer5Like", - "AffixFuzzer5Type", "Angle", "AngleArray", "AngleArrayLike", @@ -176,11 +101,6 @@ "ColorArrayLike", "ColorLike", "ColorType", - "FlattenedScalar", - "FlattenedScalarArray", - "FlattenedScalarArrayLike", - "FlattenedScalarLike", - "FlattenedScalarType", "Float32", "Float32Array", "Float32ArrayLike", @@ -206,11 +126,6 @@ "Mat4x4ArrayLike", "Mat4x4Like", "Mat4x4Type", - "PrimitiveComponent", - "PrimitiveComponentArray", - "PrimitiveComponentArrayLike", - "PrimitiveComponentLike", - "PrimitiveComponentType", "Quaternion", "QuaternionArray", "QuaternionArrayLike", @@ -231,11 +146,6 @@ "Scale3DArrayLike", "Scale3DLike", "Scale3DType", - "StringComponent", - "StringComponentArray", - "StringComponentArrayLike", - "StringComponentLike", - "StringComponentType", "TensorBuffer", "TensorBufferArray", "TensorBufferArrayLike", diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/angle.py b/rerun_py/rerun_sdk/rerun/datatypes/angle.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/angle.py rename to rerun_py/rerun_sdk/rerun/datatypes/angle.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/angle_ext.py b/rerun_py/rerun_sdk/rerun/datatypes/angle_ext.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/angle_ext.py rename to rerun_py/rerun_sdk/rerun/datatypes/angle_ext.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/annotation_info.py b/rerun_py/rerun_sdk/rerun/datatypes/annotation_info.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/annotation_info.py rename to rerun_py/rerun_sdk/rerun/datatypes/annotation_info.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/annotation_info_ext.py b/rerun_py/rerun_sdk/rerun/datatypes/annotation_info_ext.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/annotation_info_ext.py rename to rerun_py/rerun_sdk/rerun/datatypes/annotation_info_ext.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/class_description.py b/rerun_py/rerun_sdk/rerun/datatypes/class_description.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/class_description.py rename to rerun_py/rerun_sdk/rerun/datatypes/class_description.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/class_description_ext.py b/rerun_py/rerun_sdk/rerun/datatypes/class_description_ext.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/class_description_ext.py rename to rerun_py/rerun_sdk/rerun/datatypes/class_description_ext.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/class_description_map_elem.py b/rerun_py/rerun_sdk/rerun/datatypes/class_description_map_elem.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/class_description_map_elem.py rename to rerun_py/rerun_sdk/rerun/datatypes/class_description_map_elem.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/class_description_map_elem_ext.py b/rerun_py/rerun_sdk/rerun/datatypes/class_description_map_elem_ext.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/class_description_map_elem_ext.py rename to rerun_py/rerun_sdk/rerun/datatypes/class_description_map_elem_ext.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/class_id.py b/rerun_py/rerun_sdk/rerun/datatypes/class_id.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/class_id.py rename to rerun_py/rerun_sdk/rerun/datatypes/class_id.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/class_id_ext.py b/rerun_py/rerun_sdk/rerun/datatypes/class_id_ext.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/class_id_ext.py rename to rerun_py/rerun_sdk/rerun/datatypes/class_id_ext.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/color.py b/rerun_py/rerun_sdk/rerun/datatypes/color.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/color.py rename to rerun_py/rerun_sdk/rerun/datatypes/color.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/color_ext.py b/rerun_py/rerun_sdk/rerun/datatypes/color_ext.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/color_ext.py rename to rerun_py/rerun_sdk/rerun/datatypes/color_ext.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/float32.py b/rerun_py/rerun_sdk/rerun/datatypes/float32.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/float32.py rename to rerun_py/rerun_sdk/rerun/datatypes/float32.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/keypoint_id.py b/rerun_py/rerun_sdk/rerun/datatypes/keypoint_id.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/keypoint_id.py rename to rerun_py/rerun_sdk/rerun/datatypes/keypoint_id.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/keypoint_id_ext.py b/rerun_py/rerun_sdk/rerun/datatypes/keypoint_id_ext.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/keypoint_id_ext.py rename to rerun_py/rerun_sdk/rerun/datatypes/keypoint_id_ext.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/keypoint_pair.py b/rerun_py/rerun_sdk/rerun/datatypes/keypoint_pair.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/keypoint_pair.py rename to rerun_py/rerun_sdk/rerun/datatypes/keypoint_pair.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/keypoint_pair_ext.py b/rerun_py/rerun_sdk/rerun/datatypes/keypoint_pair_ext.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/keypoint_pair_ext.py rename to rerun_py/rerun_sdk/rerun/datatypes/keypoint_pair_ext.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/mat3x3.py b/rerun_py/rerun_sdk/rerun/datatypes/mat3x3.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/mat3x3.py rename to rerun_py/rerun_sdk/rerun/datatypes/mat3x3.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/mat3x3_ext.py b/rerun_py/rerun_sdk/rerun/datatypes/mat3x3_ext.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/mat3x3_ext.py rename to rerun_py/rerun_sdk/rerun/datatypes/mat3x3_ext.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/mat4x4.py b/rerun_py/rerun_sdk/rerun/datatypes/mat4x4.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/mat4x4.py rename to rerun_py/rerun_sdk/rerun/datatypes/mat4x4.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/mat4x4_ext.py b/rerun_py/rerun_sdk/rerun/datatypes/mat4x4_ext.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/mat4x4_ext.py rename to rerun_py/rerun_sdk/rerun/datatypes/mat4x4_ext.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/quaternion.py b/rerun_py/rerun_sdk/rerun/datatypes/quaternion.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/quaternion.py rename to rerun_py/rerun_sdk/rerun/datatypes/quaternion.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/quaternion_ext.py b/rerun_py/rerun_sdk/rerun/datatypes/quaternion_ext.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/quaternion_ext.py rename to rerun_py/rerun_sdk/rerun/datatypes/quaternion_ext.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/rotation3d.py b/rerun_py/rerun_sdk/rerun/datatypes/rotation3d.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/rotation3d.py rename to rerun_py/rerun_sdk/rerun/datatypes/rotation3d.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/rotation3d_ext.py b/rerun_py/rerun_sdk/rerun/datatypes/rotation3d_ext.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/rotation3d_ext.py rename to rerun_py/rerun_sdk/rerun/datatypes/rotation3d_ext.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/rotation_axis_angle.py b/rerun_py/rerun_sdk/rerun/datatypes/rotation_axis_angle.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/rotation_axis_angle.py rename to rerun_py/rerun_sdk/rerun/datatypes/rotation_axis_angle.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/rotation_axis_angle_ext.py b/rerun_py/rerun_sdk/rerun/datatypes/rotation_axis_angle_ext.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/rotation_axis_angle_ext.py rename to rerun_py/rerun_sdk/rerun/datatypes/rotation_axis_angle_ext.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/scale3d.py b/rerun_py/rerun_sdk/rerun/datatypes/scale3d.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/scale3d.py rename to rerun_py/rerun_sdk/rerun/datatypes/scale3d.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/scale3d_ext.py b/rerun_py/rerun_sdk/rerun/datatypes/scale3d_ext.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/scale3d_ext.py rename to rerun_py/rerun_sdk/rerun/datatypes/scale3d_ext.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/tensor_buffer.py b/rerun_py/rerun_sdk/rerun/datatypes/tensor_buffer.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/tensor_buffer.py rename to rerun_py/rerun_sdk/rerun/datatypes/tensor_buffer.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/tensor_buffer_ext.py b/rerun_py/rerun_sdk/rerun/datatypes/tensor_buffer_ext.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/tensor_buffer_ext.py rename to rerun_py/rerun_sdk/rerun/datatypes/tensor_buffer_ext.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/tensor_data.py b/rerun_py/rerun_sdk/rerun/datatypes/tensor_data.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/tensor_data.py rename to rerun_py/rerun_sdk/rerun/datatypes/tensor_data.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/tensor_data_ext.py b/rerun_py/rerun_sdk/rerun/datatypes/tensor_data_ext.py similarity index 99% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/tensor_data_ext.py rename to rerun_py/rerun_sdk/rerun/datatypes/tensor_data_ext.py index cb6138a1eb19..3a596beafe57 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/tensor_data_ext.py +++ b/rerun_py/rerun_sdk/rerun/datatypes/tensor_data_ext.py @@ -10,7 +10,7 @@ import pyarrow as pa from PIL import Image -from rerun.log.error_utils import _send_warning +from rerun.error_utils import _send_warning from .._unions import build_dense_union diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/tensor_dimension.py b/rerun_py/rerun_sdk/rerun/datatypes/tensor_dimension.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/tensor_dimension.py rename to rerun_py/rerun_sdk/rerun/datatypes/tensor_dimension.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/transform3d.py b/rerun_py/rerun_sdk/rerun/datatypes/transform3d.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/transform3d.py rename to rerun_py/rerun_sdk/rerun/datatypes/transform3d.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/transform3d_ext.py b/rerun_py/rerun_sdk/rerun/datatypes/transform3d_ext.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/transform3d_ext.py rename to rerun_py/rerun_sdk/rerun/datatypes/transform3d_ext.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/translation_and_mat3x3.py b/rerun_py/rerun_sdk/rerun/datatypes/translation_and_mat3x3.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/translation_and_mat3x3.py rename to rerun_py/rerun_sdk/rerun/datatypes/translation_and_mat3x3.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/translation_and_mat3x3_ext.py b/rerun_py/rerun_sdk/rerun/datatypes/translation_and_mat3x3_ext.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/translation_and_mat3x3_ext.py rename to rerun_py/rerun_sdk/rerun/datatypes/translation_and_mat3x3_ext.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/translation_rotation_scale3d.py b/rerun_py/rerun_sdk/rerun/datatypes/translation_rotation_scale3d.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/translation_rotation_scale3d.py rename to rerun_py/rerun_sdk/rerun/datatypes/translation_rotation_scale3d.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/translation_rotation_scale3d_ext.py b/rerun_py/rerun_sdk/rerun/datatypes/translation_rotation_scale3d_ext.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/translation_rotation_scale3d_ext.py rename to rerun_py/rerun_sdk/rerun/datatypes/translation_rotation_scale3d_ext.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/utf8.py b/rerun_py/rerun_sdk/rerun/datatypes/utf8.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/utf8.py rename to rerun_py/rerun_sdk/rerun/datatypes/utf8.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/utf8_ext.py b/rerun_py/rerun_sdk/rerun/datatypes/utf8_ext.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/utf8_ext.py rename to rerun_py/rerun_sdk/rerun/datatypes/utf8_ext.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/vec2d.py b/rerun_py/rerun_sdk/rerun/datatypes/vec2d.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/vec2d.py rename to rerun_py/rerun_sdk/rerun/datatypes/vec2d.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/vec2d_ext.py b/rerun_py/rerun_sdk/rerun/datatypes/vec2d_ext.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/vec2d_ext.py rename to rerun_py/rerun_sdk/rerun/datatypes/vec2d_ext.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/vec3d.py b/rerun_py/rerun_sdk/rerun/datatypes/vec3d.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/vec3d.py rename to rerun_py/rerun_sdk/rerun/datatypes/vec3d.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/vec3d_ext.py b/rerun_py/rerun_sdk/rerun/datatypes/vec3d_ext.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/vec3d_ext.py rename to rerun_py/rerun_sdk/rerun/datatypes/vec3d_ext.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/vec4d.py b/rerun_py/rerun_sdk/rerun/datatypes/vec4d.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/vec4d.py rename to rerun_py/rerun_sdk/rerun/datatypes/vec4d.py diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/vec4d_ext.py b/rerun_py/rerun_sdk/rerun/datatypes/vec4d_ext.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/vec4d_ext.py rename to rerun_py/rerun_sdk/rerun/datatypes/vec4d_ext.py diff --git a/rerun_py/rerun_sdk/rerun/log/error_utils.py b/rerun_py/rerun_sdk/rerun/error_utils.py similarity index 88% rename from rerun_py/rerun_sdk/rerun/log/error_utils.py rename to rerun_py/rerun_sdk/rerun/error_utils.py index e1eef9d74d02..7a55909b4cb1 100644 --- a/rerun_py/rerun_sdk/rerun/log/error_utils.py +++ b/rerun_py/rerun_sdk/rerun/error_utils.py @@ -4,7 +4,6 @@ import logging import rerun -from rerun.log.text_internal import log_text_entry_internal from rerun.recording_stream import RecordingStream __all__ = [ @@ -30,11 +29,13 @@ def _send_warning( You can also use this for unrecoverable problems, or raise an exception and let the @log_decorator handle it instead. """ + from rerun.experimental import TextLog, log if rerun.strict_mode(): raise TypeError(message) context_descriptor = _build_warning_context_string(skip_first=depth_to_user_code + 2) warning = f"{message}\n{context_descriptor}" - log_text_entry_internal("rerun", warning, level="WARN", recording=recording) + + log("rerun", TextLog(body=warning, level="WARN"), recording=recording) logging.warning(warning) diff --git a/rerun_py/rerun_sdk/rerun/experimental.py b/rerun_py/rerun_sdk/rerun/experimental.py index 1a37b9ffa854..5c0662cae339 100644 --- a/rerun_py/rerun_sdk/rerun/experimental.py +++ b/rerun_py/rerun_sdk/rerun/experimental.py @@ -6,7 +6,7 @@ """ from __future__ import annotations -from rerun.log.experimental.blueprint import add_space_view, new_blueprint, set_auto_space_views, set_panels +from rerun.log_deprecated.experimental.blueprint import add_space_view, new_blueprint, set_auto_space_views, set_panels __all__ = [ "AnnotationContext", @@ -41,10 +41,10 @@ ] # Next-gen API imports -from ._rerun2 import archetypes as arch -from ._rerun2 import components as cmp -from ._rerun2 import datatypes as dt -from ._rerun2.archetypes import ( +from . import archetypes as arch +from . import components as cmp +from . import datatypes as dt +from .archetypes import ( AnnotationContext, Arrows3D, Boxes2D, @@ -63,4 +63,4 @@ TextLog, Transform3D, ) -from ._rerun2.log import ArchetypeLike, ComponentBatchLike, IndicatorComponentBatch, log, log_components +from .log import ArchetypeLike, ComponentBatchLike, IndicatorComponentBatch, log, log_components diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/log.py b/rerun_py/rerun_sdk/rerun/log.py similarity index 97% rename from rerun_py/rerun_sdk/rerun/_rerun2/log.py rename to rerun_py/rerun_sdk/rerun/log.py index be8f4cad1922..ce5d6fd485c7 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/log.py +++ b/rerun_py/rerun_sdk/rerun/log.py @@ -5,11 +5,12 @@ import numpy as np import numpy.typing as npt import pyarrow as pa +import rerun_bindings as bindings -from .. import RecordingStream, bindings -from ..log import error_utils from . import components as cmp from ._baseclasses import NamedExtensionArray +from .error_utils import _send_warning +from .recording_stream import RecordingStream __all__ = ["log", "IndicatorComponentBatch", "ArchetypeLike"] @@ -93,7 +94,7 @@ def num_instances(self) -> int | None: return None -# adapted from rerun.log._add_extension_components +# adapted from rerun.log_deprecated._add_extension_components def _add_extension_components( instanced: dict[str, pa.ExtensionArray], splats: dict[str, pa.ExtensionArray], @@ -122,7 +123,7 @@ def _add_extension_components( pa_value = pa.array(np_value) ext_component_types[name] = (np_value.dtype, pa_value.type) except Exception as ex: - error_utils._send_warning( + _send_warning( f"Error converting extension data to arrow for component {name}. Dropping.\n{type(ex).__name__}: {ex}", 1, ) diff --git a/rerun_py/rerun_sdk/rerun/log/__init__.py b/rerun_py/rerun_sdk/rerun/log_deprecated/__init__.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/log/__init__.py rename to rerun_py/rerun_sdk/rerun/log_deprecated/__init__.py diff --git a/rerun_py/rerun_sdk/rerun/log/annotation.py b/rerun_py/rerun_sdk/rerun/log_deprecated/annotation.py similarity index 90% rename from rerun_py/rerun_sdk/rerun/log/annotation.py rename to rerun_py/rerun_sdk/rerun/log_deprecated/annotation.py index 0013949c85c7..ea1c30330d67 100644 --- a/rerun_py/rerun_sdk/rerun/log/annotation.py +++ b/rerun_py/rerun_sdk/rerun/log_deprecated/annotation.py @@ -2,8 +2,8 @@ from typing import Iterable -from rerun._rerun2.datatypes import AnnotationInfo, ClassDescription, ClassDescriptionLike -from rerun.log.log_decorator import log_decorator +from rerun.datatypes import AnnotationInfo, ClassDescription, ClassDescriptionLike +from rerun.log_deprecated.log_decorator import log_decorator from rerun.recording_stream import RecordingStream __all__ = ["log_annotation_context", "AnnotationInfo", "ClassDescription", "ClassDescriptionLike"] @@ -18,7 +18,7 @@ def log_annotation_context( recording: RecordingStream | None = None, ) -> None: """ - Log an annotation context made up of a collection of [ClassDescription][rerun.log.annotation.ClassDescription]s. + Log an annotation context made up of a collection of [ClassDescription][rerun.log_deprecated.annotation.ClassDescription]s. Any entity needing to access the annotation context will find it by searching the path upward. If all entities share the same you can simply log it to the diff --git a/rerun_py/rerun_sdk/rerun/log/arrow.py b/rerun_py/rerun_sdk/rerun/log_deprecated/arrow.py similarity index 95% rename from rerun_py/rerun_sdk/rerun/log/arrow.py rename to rerun_py/rerun_sdk/rerun/log_deprecated/arrow.py index a0b75489089d..c15e2c6dbb79 100644 --- a/rerun_py/rerun_sdk/rerun/log/arrow.py +++ b/rerun_py/rerun_sdk/rerun/log_deprecated/arrow.py @@ -4,8 +4,8 @@ import numpy.typing as npt -from rerun.log import Color -from rerun.log.log_decorator import log_decorator +from rerun.log_deprecated import Color +from rerun.log_deprecated.log_decorator import log_decorator from rerun.recording_stream import RecordingStream __all__ = [ diff --git a/rerun_py/rerun_sdk/rerun/log/bounding_box.py b/rerun_py/rerun_sdk/rerun/log_deprecated/bounding_box.py similarity index 98% rename from rerun_py/rerun_sdk/rerun/log/bounding_box.py rename to rerun_py/rerun_sdk/rerun/log_deprecated/bounding_box.py index 23f7a707e756..e1da2325ca64 100644 --- a/rerun_py/rerun_sdk/rerun/log/bounding_box.py +++ b/rerun_py/rerun_sdk/rerun/log_deprecated/bounding_box.py @@ -5,12 +5,12 @@ import numpy as np import numpy.typing as npt -from rerun.log import ( +from rerun.log_deprecated import ( Color, Colors, OptionalClassIds, ) -from rerun.log.log_decorator import log_decorator +from rerun.log_deprecated.log_decorator import log_decorator from rerun.recording_stream import RecordingStream __all__ = [ diff --git a/rerun_py/rerun_sdk/rerun/log/camera.py b/rerun_py/rerun_sdk/rerun/log_deprecated/camera.py similarity index 97% rename from rerun_py/rerun_sdk/rerun/log/camera.py rename to rerun_py/rerun_sdk/rerun/log_deprecated/camera.py index ed338b3ce848..ae14ebcf35b1 100644 --- a/rerun_py/rerun_sdk/rerun/log/camera.py +++ b/rerun_py/rerun_sdk/rerun/log_deprecated/camera.py @@ -3,9 +3,9 @@ import numpy.typing as npt from rerun import bindings -from rerun.components.pinhole import Pinhole, PinholeArray -from rerun.log.error_utils import _send_warning -from rerun.log.log_decorator import log_decorator +from rerun.components_deprecated.pinhole import Pinhole, PinholeArray +from rerun.error_utils import _send_warning +from rerun.log_deprecated.log_decorator import log_decorator from rerun.recording_stream import RecordingStream __all__ = [ diff --git a/rerun_py/rerun_sdk/rerun/log/clear.py b/rerun_py/rerun_sdk/rerun/log_deprecated/clear.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/log/clear.py rename to rerun_py/rerun_sdk/rerun/log_deprecated/clear.py diff --git a/rerun_py/rerun_sdk/rerun/log/experimental/__init__.py b/rerun_py/rerun_sdk/rerun/log_deprecated/experimental/__init__.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/log/experimental/__init__.py rename to rerun_py/rerun_sdk/rerun/log_deprecated/experimental/__init__.py diff --git a/rerun_py/rerun_sdk/rerun/log/experimental/blueprint.py b/rerun_py/rerun_sdk/rerun/log_deprecated/experimental/blueprint.py similarity index 100% rename from rerun_py/rerun_sdk/rerun/log/experimental/blueprint.py rename to rerun_py/rerun_sdk/rerun/log_deprecated/experimental/blueprint.py diff --git a/rerun_py/rerun_sdk/rerun/log/extension_components.py b/rerun_py/rerun_sdk/rerun/log_deprecated/extension_components.py similarity index 94% rename from rerun_py/rerun_sdk/rerun/log/extension_components.py rename to rerun_py/rerun_sdk/rerun/log_deprecated/extension_components.py index 16fbfb833044..4aa2ddda9fb1 100644 --- a/rerun_py/rerun_sdk/rerun/log/extension_components.py +++ b/rerun_py/rerun_sdk/rerun/log_deprecated/extension_components.py @@ -6,10 +6,10 @@ import numpy.typing as npt import pyarrow as pa -import rerun.log.error_utils +import rerun.error_utils from rerun import bindings -from rerun.components import instance_key_splat -from rerun.log.log_decorator import log_decorator +from rerun.components_deprecated import instance_key_splat +from rerun.log_deprecated.log_decorator import log_decorator from rerun.recording_stream import RecordingStream # Fully qualified to avoid circular import @@ -50,7 +50,7 @@ def _add_extension_components( pa_value = pa.array(np_value) EXT_COMPONENT_TYPES[name] = (np_value.dtype, pa_value.type) except Exception as ex: - rerun.log.error_utils._send_warning( + rerun.error_utils._send_warning( f"Error converting extension data to arrow for component {name}. Dropping.\n{type(ex).__name__}: {ex}", 1, ) @@ -127,7 +127,7 @@ def log_extension_components( identifiers = [int(id) for id in identifiers] identifiers_np = np.array(identifiers, dtype="uint64") except ValueError: - rerun.log.error_utils._send_warning("Only integer identifiers supported", 1) + rerun.error_utils._send_warning("Only integer identifiers supported", 1) instanced: dict[str, Any] = {} splats: dict[str, Any] = {} diff --git a/rerun_py/rerun_sdk/rerun/log/file.py b/rerun_py/rerun_sdk/rerun/log_deprecated/file.py similarity index 98% rename from rerun_py/rerun_sdk/rerun/log/file.py rename to rerun_py/rerun_sdk/rerun/log_deprecated/file.py index 056acda18f9e..1fd922ba835c 100644 --- a/rerun_py/rerun_sdk/rerun/log/file.py +++ b/rerun_py/rerun_sdk/rerun/log_deprecated/file.py @@ -8,7 +8,7 @@ import numpy.typing as npt from rerun import bindings -from rerun.log.log_decorator import log_decorator +from rerun.log_deprecated.log_decorator import log_decorator from rerun.recording_stream import RecordingStream __all__ = [ diff --git a/rerun_py/rerun_sdk/rerun/log/image.py b/rerun_py/rerun_sdk/rerun/log_deprecated/image.py similarity index 93% rename from rerun_py/rerun_sdk/rerun/log/image.py rename to rerun_py/rerun_sdk/rerun/log_deprecated/image.py index 41852ae77293..ca4b5938f61a 100644 --- a/rerun_py/rerun_sdk/rerun/log/image.py +++ b/rerun_py/rerun_sdk/rerun/log_deprecated/image.py @@ -5,8 +5,8 @@ import numpy as np import numpy.typing as npt -from rerun._rerun2.datatypes.tensor_data import TensorDataLike -from rerun.log.log_decorator import log_decorator +from rerun.datatypes.tensor_data import TensorDataLike +from rerun.log_deprecated.log_decorator import log_decorator from rerun.recording_stream import RecordingStream __all__ = [ @@ -46,7 +46,7 @@ def log_image( entity_path: Path to the image in the space hierarchy. image: - A [Tensor][rerun.log.tensor.Tensor] representing the image to log. + A [Tensor][rerun.log_deprecated.tensor.Tensor] representing the image to log. draw_order: An optional floating point value that specifies the 2D drawing order. Objects with higher values are drawn on top of those with lower values. @@ -102,7 +102,7 @@ def log_depth_image( entity_path: Path to the image in the space hierarchy. image: - A [Tensor][rerun.log.tensor.Tensor] representing the depth image to log. + A [Tensor][rerun.log_deprecated.tensor.Tensor] representing the depth image to log. draw_order: An optional floating point value that specifies the 2D drawing order. Objects with higher values are drawn on top of those with lower values. @@ -162,7 +162,7 @@ def log_segmentation_image( entity_path: Path to the image in the space hierarchy. image: - A [Tensor][rerun.log.tensor.Tensor] representing the segmentation image to log. + A [Tensor][rerun.log_deprecated.tensor.Tensor] representing the segmentation image to log. draw_order: An optional floating point value that specifies the 2D drawing order. Objects with higher values are drawn on top of those with lower values. diff --git a/rerun_py/rerun_sdk/rerun/log/lines.py b/rerun_py/rerun_sdk/rerun/log_deprecated/lines.py similarity index 98% rename from rerun_py/rerun_sdk/rerun/log/lines.py rename to rerun_py/rerun_sdk/rerun/log_deprecated/lines.py index 81b3b0c80651..07022b382451 100644 --- a/rerun_py/rerun_sdk/rerun/log/lines.py +++ b/rerun_py/rerun_sdk/rerun/log_deprecated/lines.py @@ -5,9 +5,9 @@ import numpy as np import numpy.typing as npt -from rerun.log import Color, Colors, _normalize_radii -from rerun.log.error_utils import _send_warning -from rerun.log.log_decorator import log_decorator +from rerun.error_utils import _send_warning +from rerun.log_deprecated import Color, Colors, _normalize_radii +from rerun.log_deprecated.log_decorator import log_decorator from rerun.recording_stream import RecordingStream __all__ = [ diff --git a/rerun_py/rerun_sdk/rerun/log/log_decorator.py b/rerun_py/rerun_sdk/rerun/log_deprecated/log_decorator.py similarity index 92% rename from rerun_py/rerun_sdk/rerun/log/log_decorator.py rename to rerun_py/rerun_sdk/rerun/log_deprecated/log_decorator.py index 821b02c0eaa6..9907d86b94ca 100644 --- a/rerun_py/rerun_sdk/rerun/log/log_decorator.py +++ b/rerun_py/rerun_sdk/rerun/log_deprecated/log_decorator.py @@ -7,7 +7,6 @@ import rerun from rerun import bindings -from rerun.log.text_internal import log_text_entry_internal from rerun.recording_stream import RecordingStream _TFunc = TypeVar("_TFunc", bound=Callable[..., Any]) @@ -33,6 +32,8 @@ def log_decorator(func: _TFunc) -> _TFunc: @functools.wraps(func) def wrapper(*args: Any, **kwargs: Any) -> Any: + from rerun.experimental import TextLog, log + recording = RecordingStream.to_native(kwargs.get("recording")) if not bindings.is_enabled(recording): # NOTE: use `warnings` which handles runtime deduplication. @@ -51,7 +52,7 @@ def wrapper(*args: Any, **kwargs: Any) -> Any: return func(*args, **kwargs) except Exception as e: warning = "".join(traceback.format_exception(e.__class__, e, e.__traceback__)) - log_text_entry_internal("rerun", warning, level="WARN", recording=recording) + log("rerun", TextLog(body=warning, level="WARN"), recording=recording) warnings.warn(f"Ignoring rerun log call: {warning}", category=RerunWarning, stacklevel=2) return cast(_TFunc, wrapper) diff --git a/rerun_py/rerun_sdk/rerun/log/mesh.py b/rerun_py/rerun_sdk/rerun/log_deprecated/mesh.py similarity index 98% rename from rerun_py/rerun_sdk/rerun/log/mesh.py rename to rerun_py/rerun_sdk/rerun/log_deprecated/mesh.py index d24cf3ad8127..83aeb922dc87 100644 --- a/rerun_py/rerun_sdk/rerun/log/mesh.py +++ b/rerun_py/rerun_sdk/rerun/log_deprecated/mesh.py @@ -6,8 +6,8 @@ import numpy.typing as npt from rerun import bindings -from rerun.log import Colors, _normalize_colors -from rerun.log.log_decorator import log_decorator +from rerun.log_deprecated import Colors, _normalize_colors +from rerun.log_deprecated.log_decorator import log_decorator from rerun.recording_stream import RecordingStream __all__ = [ diff --git a/rerun_py/rerun_sdk/rerun/log/points.py b/rerun_py/rerun_sdk/rerun/log_deprecated/points.py similarity index 98% rename from rerun_py/rerun_sdk/rerun/log/points.py rename to rerun_py/rerun_sdk/rerun/log_deprecated/points.py index 1027a427a313..9ccbc9faca51 100644 --- a/rerun_py/rerun_sdk/rerun/log/points.py +++ b/rerun_py/rerun_sdk/rerun/log_deprecated/points.py @@ -5,14 +5,14 @@ import numpy as np import numpy.typing as npt -from rerun.log import ( +from rerun.error_utils import _send_warning +from rerun.log_deprecated import ( Color, Colors, OptionalClassIds, OptionalKeyPointIds, ) -from rerun.log.error_utils import _send_warning -from rerun.log.log_decorator import log_decorator +from rerun.log_deprecated.log_decorator import log_decorator from rerun.recording_stream import RecordingStream __all__ = [ diff --git a/rerun_py/rerun_sdk/rerun/log/rects.py b/rerun_py/rerun_sdk/rerun/log_deprecated/rects.py similarity index 96% rename from rerun_py/rerun_sdk/rerun/log/rects.py rename to rerun_py/rerun_sdk/rerun/log_deprecated/rects.py index 81575c91707d..fd71ea04d584 100644 --- a/rerun_py/rerun_sdk/rerun/log/rects.py +++ b/rerun_py/rerun_sdk/rerun/log_deprecated/rects.py @@ -5,10 +5,10 @@ import numpy as np import numpy.typing as npt -from rerun.components.rect2d import RectFormat -from rerun.log import Color, Colors, OptionalClassIds -from rerun.log.error_utils import _send_warning -from rerun.log.log_decorator import log_decorator +from rerun.components_deprecated.rect2d import RectFormat +from rerun.error_utils import _send_warning +from rerun.log_deprecated import Color, Colors, OptionalClassIds +from rerun.log_deprecated.log_decorator import log_decorator from rerun.recording_stream import RecordingStream __all__ = [ diff --git a/rerun_py/rerun_sdk/rerun/log/scalar.py b/rerun_py/rerun_sdk/rerun/log_deprecated/scalar.py similarity index 94% rename from rerun_py/rerun_sdk/rerun/log/scalar.py rename to rerun_py/rerun_sdk/rerun/log_deprecated/scalar.py index 6f0bdd8c105d..43857bce8c7d 100644 --- a/rerun_py/rerun_sdk/rerun/log/scalar.py +++ b/rerun_py/rerun_sdk/rerun/log_deprecated/scalar.py @@ -5,11 +5,11 @@ import numpy as np from rerun import bindings -from rerun.components import instance_key_splat -from rerun.components.scalar import ScalarArray, ScalarPlotPropsArray -from rerun.log import Color, _normalize_colors -from rerun.log.extension_components import _add_extension_components -from rerun.log.log_decorator import log_decorator +from rerun.components_deprecated import instance_key_splat +from rerun.components_deprecated.scalar import ScalarArray, ScalarPlotPropsArray +from rerun.log_deprecated import Color, _normalize_colors +from rerun.log_deprecated.extension_components import _add_extension_components +from rerun.log_deprecated.log_decorator import log_decorator from rerun.recording_stream import RecordingStream __all__ = [ diff --git a/rerun_py/rerun_sdk/rerun/log/tensor.py b/rerun_py/rerun_sdk/rerun/log_deprecated/tensor.py similarity index 92% rename from rerun_py/rerun_sdk/rerun/log/tensor.py rename to rerun_py/rerun_sdk/rerun/log_deprecated/tensor.py index c5c2eb761311..8ba77260be1c 100644 --- a/rerun_py/rerun_sdk/rerun/log/tensor.py +++ b/rerun_py/rerun_sdk/rerun/log_deprecated/tensor.py @@ -5,9 +5,9 @@ import numpy as np import numpy.typing as npt -from rerun._rerun2.datatypes.tensor_data import TensorDataLike -from rerun.log.error_utils import _send_warning -from rerun.log.log_decorator import log_decorator +from rerun.datatypes.tensor_data import TensorDataLike +from rerun.error_utils import _send_warning +from rerun.log_deprecated.log_decorator import log_decorator from rerun.recording_stream import RecordingStream __all__ = [ @@ -57,7 +57,7 @@ def log_tensor( entity_path: Path to the tensor in the space hierarchy. tensor: - A [Tensor][rerun.log.tensor.Tensor] object. + A [Tensor][rerun.log_deprecated.tensor.Tensor] object. names: Optional names for each dimension of the tensor. meter: diff --git a/rerun_py/rerun_sdk/rerun/log/text.py b/rerun_py/rerun_sdk/rerun/log_deprecated/text.py similarity index 96% rename from rerun_py/rerun_sdk/rerun/log/text.py rename to rerun_py/rerun_sdk/rerun/log_deprecated/text.py index af5649beb020..01f550b0f4ae 100644 --- a/rerun_py/rerun_sdk/rerun/log/text.py +++ b/rerun_py/rerun_sdk/rerun/log_deprecated/text.py @@ -3,8 +3,8 @@ import logging from typing import Any, Final -from rerun.log import Color, _normalize_colors -from rerun.log.log_decorator import log_decorator +from rerun.log_deprecated import Color, _normalize_colors +from rerun.log_deprecated.log_decorator import log_decorator from rerun.recording_stream import RecordingStream # Fully qualified to avoid circular import diff --git a/rerun_py/rerun_sdk/rerun/log/text_internal.py b/rerun_py/rerun_sdk/rerun/log_deprecated/text_internal.py similarity index 96% rename from rerun_py/rerun_sdk/rerun/log/text_internal.py rename to rerun_py/rerun_sdk/rerun/log_deprecated/text_internal.py index d27acbabaf05..e0ea0bd670fe 100644 --- a/rerun_py/rerun_sdk/rerun/log/text_internal.py +++ b/rerun_py/rerun_sdk/rerun/log_deprecated/text_internal.py @@ -1,6 +1,6 @@ from __future__ import annotations -from rerun.log import Color, _normalize_colors +from rerun.log_deprecated import Color, _normalize_colors from rerun.recording_stream import RecordingStream # Fully qualified to avoid circular import diff --git a/rerun_py/rerun_sdk/rerun/log/transform.py b/rerun_py/rerun_sdk/rerun/log_deprecated/transform.py similarity index 98% rename from rerun_py/rerun_sdk/rerun/log/transform.py rename to rerun_py/rerun_sdk/rerun/log_deprecated/transform.py index 774eae937a7f..eed8a97c0485 100644 --- a/rerun_py/rerun_sdk/rerun/log/transform.py +++ b/rerun_py/rerun_sdk/rerun/log_deprecated/transform.py @@ -9,8 +9,8 @@ from deprecated import deprecated from rerun import bindings -from rerun.components.quaternion import Quaternion -from rerun.components.transform3d import ( +from rerun.components_deprecated.quaternion import Quaternion +from rerun.components_deprecated.transform3d import ( Rigid3D, RotationAxisAngle, Scale3D, @@ -18,8 +18,8 @@ TranslationAndMat3, TranslationRotationScale3D, ) -from rerun.log.error_utils import _send_warning -from rerun.log.log_decorator import log_decorator +from rerun.error_utils import _send_warning +from rerun.log_deprecated.log_decorator import log_decorator from rerun.recording_stream import RecordingStream __all__ = [ diff --git a/rerun_py/rerun_sdk/rerun_demo/data.py b/rerun_py/rerun_sdk/rerun_demo/data.py index 20c7c5f90332..d6a36b9aad8d 100644 --- a/rerun_py/rerun_sdk/rerun_demo/data.py +++ b/rerun_py/rerun_sdk/rerun_demo/data.py @@ -5,7 +5,7 @@ from math import cos, sin, tau import numpy as np -from rerun.log.rects import RectFormat +from rerun import RectFormat from rerun_demo.turbo import turbo_colormap_data diff --git a/rerun_py/tests/test_types/.gitattributes b/rerun_py/tests/test_types/.gitattributes new file mode 100644 index 000000000000..c02bf0a689de --- /dev/null +++ b/rerun_py/tests/test_types/.gitattributes @@ -0,0 +1,38 @@ +# DO NOT EDIT! This file is generated by crates/re_types_builder/src/lib.rs + +.gitattributes linguist-generated=true +archetypes/__init__.py linguist-generated=true +archetypes/affix_fuzzer1.py linguist-generated=true +components/__init__.py linguist-generated=true +components/affix_fuzzer1.py linguist-generated=true +components/affix_fuzzer10.py linguist-generated=true +components/affix_fuzzer11.py linguist-generated=true +components/affix_fuzzer12.py linguist-generated=true +components/affix_fuzzer13.py linguist-generated=true +components/affix_fuzzer14.py linguist-generated=true +components/affix_fuzzer15.py linguist-generated=true +components/affix_fuzzer16.py linguist-generated=true +components/affix_fuzzer17.py linguist-generated=true +components/affix_fuzzer18.py linguist-generated=true +components/affix_fuzzer19.py linguist-generated=true +components/affix_fuzzer2.py linguist-generated=true +components/affix_fuzzer20.py linguist-generated=true +components/affix_fuzzer21.py linguist-generated=true +components/affix_fuzzer3.py linguist-generated=true +components/affix_fuzzer4.py linguist-generated=true +components/affix_fuzzer5.py linguist-generated=true +components/affix_fuzzer6.py linguist-generated=true +components/affix_fuzzer7.py linguist-generated=true +components/affix_fuzzer8.py linguist-generated=true +components/affix_fuzzer9.py linguist-generated=true +datatypes/__init__.py linguist-generated=true +datatypes/affix_fuzzer1.py linguist-generated=true +datatypes/affix_fuzzer2.py linguist-generated=true +datatypes/affix_fuzzer20.py linguist-generated=true +datatypes/affix_fuzzer21.py linguist-generated=true +datatypes/affix_fuzzer3.py linguist-generated=true +datatypes/affix_fuzzer4.py linguist-generated=true +datatypes/affix_fuzzer5.py linguist-generated=true +datatypes/flattened_scalar.py linguist-generated=true +datatypes/primitive_component.py linguist-generated=true +datatypes/string_component.py linguist-generated=true diff --git a/rerun_py/tests/test_types/__init__.py b/rerun_py/tests/test_types/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/rerun_py/tests/test_types/archetypes/__init__.py b/rerun_py/tests/test_types/archetypes/__init__.py new file mode 100644 index 000000000000..95649aa9c20f --- /dev/null +++ b/rerun_py/tests/test_types/archetypes/__init__.py @@ -0,0 +1,7 @@ +# DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/python.rs + +from __future__ import annotations + +from .affix_fuzzer1 import AffixFuzzer1 + +__all__ = ["AffixFuzzer1"] diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/affix_fuzzer1.py b/rerun_py/tests/test_types/archetypes/affix_fuzzer1.py similarity index 99% rename from rerun_py/rerun_sdk/rerun/_rerun2/archetypes/affix_fuzzer1.py rename to rerun_py/tests/test_types/archetypes/affix_fuzzer1.py index 0d94debd7589..aa2ea74439f6 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/archetypes/affix_fuzzer1.py +++ b/rerun_py/tests/test_types/archetypes/affix_fuzzer1.py @@ -6,12 +6,12 @@ from __future__ import annotations from attrs import define, field - -from .. import components -from .._baseclasses import ( +from rerun._baseclasses import ( Archetype, ) +from .. import components + __all__ = ["AffixFuzzer1"] diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/__init__.py b/rerun_py/tests/test_types/components/__init__.py similarity index 51% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/__init__.py rename to rerun_py/tests/test_types/components/__init__.py index 04dd797675ef..2e02f3ebeccf 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/__init__.py +++ b/rerun_py/tests/test_types/components/__init__.py @@ -65,49 +65,6 @@ from .affix_fuzzer19 import AffixFuzzer19, AffixFuzzer19Array, AffixFuzzer19Type from .affix_fuzzer20 import AffixFuzzer20, AffixFuzzer20Array, AffixFuzzer20Type from .affix_fuzzer21 import AffixFuzzer21, AffixFuzzer21Array, AffixFuzzer21Type -from .annotation_context import ( - AnnotationContext, - AnnotationContextArray, - AnnotationContextArrayLike, - AnnotationContextLike, - AnnotationContextType, -) -from .class_id import ClassId, ClassIdArray, ClassIdType -from .clear_settings import ( - ClearSettings, - ClearSettingsArray, - ClearSettingsArrayLike, - ClearSettingsLike, - ClearSettingsType, -) -from .color import Color, ColorArray, ColorType -from .depth_meter import DepthMeter, DepthMeterArray, DepthMeterArrayLike, DepthMeterLike, DepthMeterType -from .disconnected_space import ( - DisconnectedSpace, - DisconnectedSpaceArray, - DisconnectedSpaceArrayLike, - DisconnectedSpaceLike, - DisconnectedSpaceType, -) -from .draw_order import DrawOrder, DrawOrderArray, DrawOrderArrayLike, DrawOrderLike, DrawOrderType -from .half_sizes2d import HalfSizes2D, HalfSizes2DArray, HalfSizes2DType -from .half_sizes3d import HalfSizes3D, HalfSizes3DArray, HalfSizes3DType -from .instance_key import InstanceKey, InstanceKeyArray, InstanceKeyArrayLike, InstanceKeyLike, InstanceKeyType -from .keypoint_id import KeypointId, KeypointIdArray, KeypointIdType -from .line_strip2d import LineStrip2D, LineStrip2DArray, LineStrip2DArrayLike, LineStrip2DLike, LineStrip2DType -from .line_strip3d import LineStrip3D, LineStrip3DArray, LineStrip3DArrayLike, LineStrip3DLike, LineStrip3DType -from .media_type import MediaType, MediaTypeArray, MediaTypeType -from .origin2d import Origin2D, Origin2DArray, Origin2DType -from .origin3d import Origin3D, Origin3DArray, Origin3DType -from .position2d import Position2D, Position2DArray, Position2DType -from .position3d import Position3D, Position3DArray, Position3DType -from .radius import Radius, RadiusArray, RadiusArrayLike, RadiusLike, RadiusType -from .rotation3d import Rotation3D, Rotation3DArray, Rotation3DType -from .tensor_data import TensorData, TensorDataArray, TensorDataType -from .text import Text, TextArray, TextType -from .text_log_level import TextLogLevel, TextLogLevelArray, TextLogLevelType -from .transform3d import Transform3D, Transform3DArray, Transform3DType -from .vector3d import Vector3D, Vector3DArray, Vector3DType __all__ = [ "AffixFuzzer1", @@ -193,97 +150,4 @@ "AffixFuzzer9ArrayLike", "AffixFuzzer9Like", "AffixFuzzer9Type", - "AnnotationContext", - "AnnotationContextArray", - "AnnotationContextArrayLike", - "AnnotationContextLike", - "AnnotationContextType", - "ClassId", - "ClassIdArray", - "ClassIdType", - "ClearSettings", - "ClearSettingsArray", - "ClearSettingsArrayLike", - "ClearSettingsLike", - "ClearSettingsType", - "Color", - "ColorArray", - "ColorType", - "DepthMeter", - "DepthMeterArray", - "DepthMeterArrayLike", - "DepthMeterLike", - "DepthMeterType", - "DisconnectedSpace", - "DisconnectedSpaceArray", - "DisconnectedSpaceArrayLike", - "DisconnectedSpaceLike", - "DisconnectedSpaceType", - "DrawOrder", - "DrawOrderArray", - "DrawOrderArrayLike", - "DrawOrderLike", - "DrawOrderType", - "HalfSizes2D", - "HalfSizes2DArray", - "HalfSizes2DType", - "HalfSizes3D", - "HalfSizes3DArray", - "HalfSizes3DType", - "InstanceKey", - "InstanceKeyArray", - "InstanceKeyArrayLike", - "InstanceKeyLike", - "InstanceKeyType", - "KeypointId", - "KeypointIdArray", - "KeypointIdType", - "LineStrip2D", - "LineStrip2DArray", - "LineStrip2DArrayLike", - "LineStrip2DLike", - "LineStrip2DType", - "LineStrip3D", - "LineStrip3DArray", - "LineStrip3DArrayLike", - "LineStrip3DLike", - "LineStrip3DType", - "MediaType", - "MediaTypeArray", - "MediaTypeType", - "Origin2D", - "Origin2DArray", - "Origin2DType", - "Origin3D", - "Origin3DArray", - "Origin3DType", - "Position2D", - "Position2DArray", - "Position2DType", - "Position3D", - "Position3DArray", - "Position3DType", - "Radius", - "RadiusArray", - "RadiusArrayLike", - "RadiusLike", - "RadiusType", - "Rotation3D", - "Rotation3DArray", - "Rotation3DType", - "TensorData", - "TensorDataArray", - "TensorDataType", - "Text", - "TextArray", - "TextLogLevel", - "TextLogLevelArray", - "TextLogLevelType", - "TextType", - "Transform3D", - "Transform3DArray", - "Transform3DType", - "Vector3D", - "Vector3DArray", - "Vector3DType", ] diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer1.py b/rerun_py/tests/test_types/components/affix_fuzzer1.py similarity index 97% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer1.py rename to rerun_py/tests/test_types/components/affix_fuzzer1.py index a92353d459b3..9e6518027371 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer1.py +++ b/rerun_py/tests/test_types/components/affix_fuzzer1.py @@ -5,12 +5,13 @@ from __future__ import annotations -from .. import datatypes -from .._baseclasses import ( +from rerun._baseclasses import ( BaseDelegatingExtensionArray, BaseDelegatingExtensionType, ) +from .. import datatypes + __all__ = ["AffixFuzzer1", "AffixFuzzer1Array", "AffixFuzzer1Type"] diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer10.py b/rerun_py/tests/test_types/components/affix_fuzzer10.py similarity index 96% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer10.py rename to rerun_py/tests/test_types/components/affix_fuzzer10.py index 7bae2bcf6856..e855654495e1 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer10.py +++ b/rerun_py/tests/test_types/components/affix_fuzzer10.py @@ -9,12 +9,11 @@ import pyarrow as pa from attrs import define, field - -from .._baseclasses import ( +from rerun._baseclasses import ( BaseExtensionArray, BaseExtensionType, ) -from .._converters import ( +from rerun._converters import ( str_or_none, ) diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer11.py b/rerun_py/tests/test_types/components/affix_fuzzer11.py similarity index 97% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer11.py rename to rerun_py/tests/test_types/components/affix_fuzzer11.py index ce7ea79c7e97..6bf6f4757145 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer11.py +++ b/rerun_py/tests/test_types/components/affix_fuzzer11.py @@ -11,12 +11,11 @@ import numpy.typing as npt import pyarrow as pa from attrs import define, field - -from .._baseclasses import ( +from rerun._baseclasses import ( BaseExtensionArray, BaseExtensionType, ) -from .._converters import ( +from rerun._converters import ( to_np_float32, ) diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer12.py b/rerun_py/tests/test_types/components/affix_fuzzer12.py similarity index 98% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer12.py rename to rerun_py/tests/test_types/components/affix_fuzzer12.py index e932a326d34a..201f091c0877 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer12.py +++ b/rerun_py/tests/test_types/components/affix_fuzzer12.py @@ -9,8 +9,7 @@ import pyarrow as pa from attrs import define, field - -from .._baseclasses import ( +from rerun._baseclasses import ( BaseExtensionArray, BaseExtensionType, ) diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer13.py b/rerun_py/tests/test_types/components/affix_fuzzer13.py similarity index 98% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer13.py rename to rerun_py/tests/test_types/components/affix_fuzzer13.py index b0f6f9140c4c..6045ed081b02 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer13.py +++ b/rerun_py/tests/test_types/components/affix_fuzzer13.py @@ -9,8 +9,7 @@ import pyarrow as pa from attrs import define, field - -from .._baseclasses import ( +from rerun._baseclasses import ( BaseExtensionArray, BaseExtensionType, ) diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer14.py b/rerun_py/tests/test_types/components/affix_fuzzer14.py similarity index 97% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer14.py rename to rerun_py/tests/test_types/components/affix_fuzzer14.py index 20bf3cc962ee..039287791193 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer14.py +++ b/rerun_py/tests/test_types/components/affix_fuzzer14.py @@ -5,12 +5,13 @@ from __future__ import annotations -from .. import datatypes -from .._baseclasses import ( +from rerun._baseclasses import ( BaseDelegatingExtensionArray, BaseDelegatingExtensionType, ) +from .. import datatypes + __all__ = ["AffixFuzzer14", "AffixFuzzer14Array", "AffixFuzzer14Type"] diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer15.py b/rerun_py/tests/test_types/components/affix_fuzzer15.py similarity index 97% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer15.py rename to rerun_py/tests/test_types/components/affix_fuzzer15.py index 9bdcb80efc93..c96335b06f54 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer15.py +++ b/rerun_py/tests/test_types/components/affix_fuzzer15.py @@ -5,12 +5,13 @@ from __future__ import annotations -from .. import datatypes -from .._baseclasses import ( +from rerun._baseclasses import ( BaseDelegatingExtensionArray, BaseDelegatingExtensionType, ) +from .. import datatypes + __all__ = ["AffixFuzzer15", "AffixFuzzer15Array", "AffixFuzzer15Type"] diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer16.py b/rerun_py/tests/test_types/components/affix_fuzzer16.py similarity index 99% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer16.py rename to rerun_py/tests/test_types/components/affix_fuzzer16.py index 1d095c3ceac9..675b2740c42e 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer16.py +++ b/rerun_py/tests/test_types/components/affix_fuzzer16.py @@ -9,13 +9,13 @@ import pyarrow as pa from attrs import define, field - -from .. import datatypes -from .._baseclasses import ( +from rerun._baseclasses import ( BaseExtensionArray, BaseExtensionType, ) +from .. import datatypes + __all__ = ["AffixFuzzer16", "AffixFuzzer16Array", "AffixFuzzer16ArrayLike", "AffixFuzzer16Like", "AffixFuzzer16Type"] diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer17.py b/rerun_py/tests/test_types/components/affix_fuzzer17.py similarity index 99% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer17.py rename to rerun_py/tests/test_types/components/affix_fuzzer17.py index 1975cc175010..a2e902d2dd21 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer17.py +++ b/rerun_py/tests/test_types/components/affix_fuzzer17.py @@ -9,13 +9,13 @@ import pyarrow as pa from attrs import define, field - -from .. import datatypes -from .._baseclasses import ( +from rerun._baseclasses import ( BaseExtensionArray, BaseExtensionType, ) +from .. import datatypes + __all__ = ["AffixFuzzer17", "AffixFuzzer17Array", "AffixFuzzer17ArrayLike", "AffixFuzzer17Like", "AffixFuzzer17Type"] diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer18.py b/rerun_py/tests/test_types/components/affix_fuzzer18.py similarity index 99% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer18.py rename to rerun_py/tests/test_types/components/affix_fuzzer18.py index b961d46405c0..ef294727bf70 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer18.py +++ b/rerun_py/tests/test_types/components/affix_fuzzer18.py @@ -9,13 +9,13 @@ import pyarrow as pa from attrs import define, field - -from .. import datatypes -from .._baseclasses import ( +from rerun._baseclasses import ( BaseExtensionArray, BaseExtensionType, ) +from .. import datatypes + __all__ = ["AffixFuzzer18", "AffixFuzzer18Array", "AffixFuzzer18ArrayLike", "AffixFuzzer18Like", "AffixFuzzer18Type"] diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer19.py b/rerun_py/tests/test_types/components/affix_fuzzer19.py similarity index 97% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer19.py rename to rerun_py/tests/test_types/components/affix_fuzzer19.py index 9e7d1b1c2fc5..ba7332ba5cf5 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer19.py +++ b/rerun_py/tests/test_types/components/affix_fuzzer19.py @@ -5,12 +5,13 @@ from __future__ import annotations -from .. import datatypes -from .._baseclasses import ( +from rerun._baseclasses import ( BaseDelegatingExtensionArray, BaseDelegatingExtensionType, ) +from .. import datatypes + __all__ = ["AffixFuzzer19", "AffixFuzzer19Array", "AffixFuzzer19Type"] diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer2.py b/rerun_py/tests/test_types/components/affix_fuzzer2.py similarity index 97% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer2.py rename to rerun_py/tests/test_types/components/affix_fuzzer2.py index 8576244e8048..e010697ea3b3 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer2.py +++ b/rerun_py/tests/test_types/components/affix_fuzzer2.py @@ -5,12 +5,13 @@ from __future__ import annotations -from .. import datatypes -from .._baseclasses import ( +from rerun._baseclasses import ( BaseDelegatingExtensionArray, BaseDelegatingExtensionType, ) +from .. import datatypes + __all__ = ["AffixFuzzer2", "AffixFuzzer2Array", "AffixFuzzer2Type"] diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer20.py b/rerun_py/tests/test_types/components/affix_fuzzer20.py similarity index 97% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer20.py rename to rerun_py/tests/test_types/components/affix_fuzzer20.py index 1a74ae5d7a88..39ccf8942ded 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer20.py +++ b/rerun_py/tests/test_types/components/affix_fuzzer20.py @@ -5,12 +5,13 @@ from __future__ import annotations -from .. import datatypes -from .._baseclasses import ( +from rerun._baseclasses import ( BaseDelegatingExtensionArray, BaseDelegatingExtensionType, ) +from .. import datatypes + __all__ = ["AffixFuzzer20", "AffixFuzzer20Array", "AffixFuzzer20Type"] diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer21.py b/rerun_py/tests/test_types/components/affix_fuzzer21.py similarity index 97% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer21.py rename to rerun_py/tests/test_types/components/affix_fuzzer21.py index 74cedf4d7d3f..da42b2db8565 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer21.py +++ b/rerun_py/tests/test_types/components/affix_fuzzer21.py @@ -5,12 +5,13 @@ from __future__ import annotations -from .. import datatypes -from .._baseclasses import ( +from rerun._baseclasses import ( BaseDelegatingExtensionArray, BaseDelegatingExtensionType, ) +from .. import datatypes + __all__ = ["AffixFuzzer21", "AffixFuzzer21Array", "AffixFuzzer21Type"] diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer3.py b/rerun_py/tests/test_types/components/affix_fuzzer3.py similarity index 97% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer3.py rename to rerun_py/tests/test_types/components/affix_fuzzer3.py index 35fac3716e58..bb587a07f141 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer3.py +++ b/rerun_py/tests/test_types/components/affix_fuzzer3.py @@ -5,12 +5,13 @@ from __future__ import annotations -from .. import datatypes -from .._baseclasses import ( +from rerun._baseclasses import ( BaseDelegatingExtensionArray, BaseDelegatingExtensionType, ) +from .. import datatypes + __all__ = ["AffixFuzzer3", "AffixFuzzer3Array", "AffixFuzzer3Type"] diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer4.py b/rerun_py/tests/test_types/components/affix_fuzzer4.py similarity index 97% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer4.py rename to rerun_py/tests/test_types/components/affix_fuzzer4.py index 70eab78927c7..bcafe894ebd7 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer4.py +++ b/rerun_py/tests/test_types/components/affix_fuzzer4.py @@ -5,12 +5,13 @@ from __future__ import annotations -from .. import datatypes -from .._baseclasses import ( +from rerun._baseclasses import ( BaseDelegatingExtensionArray, BaseDelegatingExtensionType, ) +from .. import datatypes + __all__ = ["AffixFuzzer4", "AffixFuzzer4Array", "AffixFuzzer4Type"] diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer5.py b/rerun_py/tests/test_types/components/affix_fuzzer5.py similarity index 97% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer5.py rename to rerun_py/tests/test_types/components/affix_fuzzer5.py index f9389444ac29..5a97a0fe59f9 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer5.py +++ b/rerun_py/tests/test_types/components/affix_fuzzer5.py @@ -5,12 +5,13 @@ from __future__ import annotations -from .. import datatypes -from .._baseclasses import ( +from rerun._baseclasses import ( BaseDelegatingExtensionArray, BaseDelegatingExtensionType, ) +from .. import datatypes + __all__ = ["AffixFuzzer5", "AffixFuzzer5Array", "AffixFuzzer5Type"] diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer6.py b/rerun_py/tests/test_types/components/affix_fuzzer6.py similarity index 97% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer6.py rename to rerun_py/tests/test_types/components/affix_fuzzer6.py index 64275421a620..5be17637659e 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer6.py +++ b/rerun_py/tests/test_types/components/affix_fuzzer6.py @@ -5,12 +5,13 @@ from __future__ import annotations -from .. import datatypes -from .._baseclasses import ( +from rerun._baseclasses import ( BaseDelegatingExtensionArray, BaseDelegatingExtensionType, ) +from .. import datatypes + __all__ = ["AffixFuzzer6", "AffixFuzzer6Array", "AffixFuzzer6Type"] diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer7.py b/rerun_py/tests/test_types/components/affix_fuzzer7.py similarity index 99% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer7.py rename to rerun_py/tests/test_types/components/affix_fuzzer7.py index ebc3f0092537..35785dfb3e2a 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer7.py +++ b/rerun_py/tests/test_types/components/affix_fuzzer7.py @@ -9,13 +9,13 @@ import pyarrow as pa from attrs import define, field - -from .. import datatypes -from .._baseclasses import ( +from rerun._baseclasses import ( BaseExtensionArray, BaseExtensionType, ) +from .. import datatypes + __all__ = ["AffixFuzzer7", "AffixFuzzer7Array", "AffixFuzzer7ArrayLike", "AffixFuzzer7Like", "AffixFuzzer7Type"] diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer8.py b/rerun_py/tests/test_types/components/affix_fuzzer8.py similarity index 96% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer8.py rename to rerun_py/tests/test_types/components/affix_fuzzer8.py index 9f8c3f11f7ae..501511c95a24 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer8.py +++ b/rerun_py/tests/test_types/components/affix_fuzzer8.py @@ -11,12 +11,11 @@ import numpy.typing as npt import pyarrow as pa from attrs import define, field - -from .._baseclasses import ( +from rerun._baseclasses import ( BaseExtensionArray, BaseExtensionType, ) -from .._converters import ( +from rerun._converters import ( float_or_none, ) diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer9.py b/rerun_py/tests/test_types/components/affix_fuzzer9.py similarity index 98% rename from rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer9.py rename to rerun_py/tests/test_types/components/affix_fuzzer9.py index 5ebadd54f2fb..d4ff05e9f215 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/components/affix_fuzzer9.py +++ b/rerun_py/tests/test_types/components/affix_fuzzer9.py @@ -9,8 +9,7 @@ import pyarrow as pa from attrs import define, field - -from .._baseclasses import ( +from rerun._baseclasses import ( BaseExtensionArray, BaseExtensionType, ) diff --git a/rerun_py/tests/test_types/datatypes/__init__.py b/rerun_py/tests/test_types/datatypes/__init__.py new file mode 100644 index 000000000000..6f123d5d70f3 --- /dev/null +++ b/rerun_py/tests/test_types/datatypes/__init__.py @@ -0,0 +1,97 @@ +# DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/python.rs + +from __future__ import annotations + +from .affix_fuzzer1 import AffixFuzzer1, AffixFuzzer1Array, AffixFuzzer1ArrayLike, AffixFuzzer1Like, AffixFuzzer1Type +from .affix_fuzzer2 import AffixFuzzer2, AffixFuzzer2Array, AffixFuzzer2ArrayLike, AffixFuzzer2Like, AffixFuzzer2Type +from .affix_fuzzer3 import AffixFuzzer3, AffixFuzzer3Array, AffixFuzzer3ArrayLike, AffixFuzzer3Like, AffixFuzzer3Type +from .affix_fuzzer4 import AffixFuzzer4, AffixFuzzer4Array, AffixFuzzer4ArrayLike, AffixFuzzer4Like, AffixFuzzer4Type +from .affix_fuzzer5 import AffixFuzzer5, AffixFuzzer5Array, AffixFuzzer5ArrayLike, AffixFuzzer5Like, AffixFuzzer5Type +from .affix_fuzzer20 import ( + AffixFuzzer20, + AffixFuzzer20Array, + AffixFuzzer20ArrayLike, + AffixFuzzer20Like, + AffixFuzzer20Type, +) +from .affix_fuzzer21 import ( + AffixFuzzer21, + AffixFuzzer21Array, + AffixFuzzer21ArrayLike, + AffixFuzzer21Like, + AffixFuzzer21Type, +) +from .flattened_scalar import ( + FlattenedScalar, + FlattenedScalarArray, + FlattenedScalarArrayLike, + FlattenedScalarLike, + FlattenedScalarType, +) +from .primitive_component import ( + PrimitiveComponent, + PrimitiveComponentArray, + PrimitiveComponentArrayLike, + PrimitiveComponentLike, + PrimitiveComponentType, +) +from .string_component import ( + StringComponent, + StringComponentArray, + StringComponentArrayLike, + StringComponentLike, + StringComponentType, +) + +__all__ = [ + "AffixFuzzer1", + "AffixFuzzer1Array", + "AffixFuzzer1ArrayLike", + "AffixFuzzer1Like", + "AffixFuzzer1Type", + "AffixFuzzer2", + "AffixFuzzer20", + "AffixFuzzer20Array", + "AffixFuzzer20ArrayLike", + "AffixFuzzer20Like", + "AffixFuzzer20Type", + "AffixFuzzer21", + "AffixFuzzer21Array", + "AffixFuzzer21ArrayLike", + "AffixFuzzer21Like", + "AffixFuzzer21Type", + "AffixFuzzer2Array", + "AffixFuzzer2ArrayLike", + "AffixFuzzer2Like", + "AffixFuzzer2Type", + "AffixFuzzer3", + "AffixFuzzer3Array", + "AffixFuzzer3ArrayLike", + "AffixFuzzer3Like", + "AffixFuzzer3Type", + "AffixFuzzer4", + "AffixFuzzer4Array", + "AffixFuzzer4ArrayLike", + "AffixFuzzer4Like", + "AffixFuzzer4Type", + "AffixFuzzer5", + "AffixFuzzer5Array", + "AffixFuzzer5ArrayLike", + "AffixFuzzer5Like", + "AffixFuzzer5Type", + "FlattenedScalar", + "FlattenedScalarArray", + "FlattenedScalarArrayLike", + "FlattenedScalarLike", + "FlattenedScalarType", + "PrimitiveComponent", + "PrimitiveComponentArray", + "PrimitiveComponentArrayLike", + "PrimitiveComponentLike", + "PrimitiveComponentType", + "StringComponent", + "StringComponentArray", + "StringComponentArrayLike", + "StringComponentLike", + "StringComponentType", +] diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer1.py b/rerun_py/tests/test_types/datatypes/affix_fuzzer1.py similarity index 98% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer1.py rename to rerun_py/tests/test_types/datatypes/affix_fuzzer1.py index 097ec24ad074..548d9dd69810 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer1.py +++ b/rerun_py/tests/test_types/datatypes/affix_fuzzer1.py @@ -11,19 +11,19 @@ import numpy.typing as npt import pyarrow as pa from attrs import define, field - -from .. import datatypes -from .._baseclasses import ( +from rerun._baseclasses import ( BaseExtensionArray, BaseExtensionType, ) -from .._converters import ( +from rerun._converters import ( bool_or_none, float_or_none, str_or_none, to_np_float32, ) +from .. import datatypes + __all__ = ["AffixFuzzer1", "AffixFuzzer1Array", "AffixFuzzer1ArrayLike", "AffixFuzzer1Like", "AffixFuzzer1Type"] diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer2.py b/rerun_py/tests/test_types/datatypes/affix_fuzzer2.py similarity index 96% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer2.py rename to rerun_py/tests/test_types/datatypes/affix_fuzzer2.py index 801e6696e01f..7361ae949367 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer2.py +++ b/rerun_py/tests/test_types/datatypes/affix_fuzzer2.py @@ -11,12 +11,11 @@ import numpy.typing as npt import pyarrow as pa from attrs import define, field - -from .._baseclasses import ( +from rerun._baseclasses import ( BaseExtensionArray, BaseExtensionType, ) -from .._converters import ( +from rerun._converters import ( float_or_none, ) diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer20.py b/rerun_py/tests/test_types/datatypes/affix_fuzzer20.py similarity index 98% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer20.py rename to rerun_py/tests/test_types/datatypes/affix_fuzzer20.py index dd74def12db6..3258c174906c 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer20.py +++ b/rerun_py/tests/test_types/datatypes/affix_fuzzer20.py @@ -9,13 +9,13 @@ import pyarrow as pa from attrs import define, field - -from .. import datatypes -from .._baseclasses import ( +from rerun._baseclasses import ( BaseExtensionArray, BaseExtensionType, ) +from .. import datatypes + __all__ = ["AffixFuzzer20", "AffixFuzzer20Array", "AffixFuzzer20ArrayLike", "AffixFuzzer20Like", "AffixFuzzer20Type"] diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer21.py b/rerun_py/tests/test_types/datatypes/affix_fuzzer21.py similarity index 97% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer21.py rename to rerun_py/tests/test_types/datatypes/affix_fuzzer21.py index 8ca3789e5b66..e8e17097a6d8 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer21.py +++ b/rerun_py/tests/test_types/datatypes/affix_fuzzer21.py @@ -11,12 +11,11 @@ import numpy.typing as npt import pyarrow as pa from attrs import define, field - -from .._baseclasses import ( +from rerun._baseclasses import ( BaseExtensionArray, BaseExtensionType, ) -from .._converters import ( +from rerun._converters import ( to_np_float16, ) diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer3.py b/rerun_py/tests/test_types/datatypes/affix_fuzzer3.py similarity index 99% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer3.py rename to rerun_py/tests/test_types/datatypes/affix_fuzzer3.py index 471b1a2aa0d2..7b3f01f4c03d 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer3.py +++ b/rerun_py/tests/test_types/datatypes/affix_fuzzer3.py @@ -11,13 +11,13 @@ import numpy.typing as npt import pyarrow as pa from attrs import define, field - -from .. import datatypes -from .._baseclasses import ( +from rerun._baseclasses import ( BaseExtensionArray, BaseExtensionType, ) +from .. import datatypes + __all__ = ["AffixFuzzer3", "AffixFuzzer3Array", "AffixFuzzer3ArrayLike", "AffixFuzzer3Like", "AffixFuzzer3Type"] diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer4.py b/rerun_py/tests/test_types/datatypes/affix_fuzzer4.py similarity index 99% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer4.py rename to rerun_py/tests/test_types/datatypes/affix_fuzzer4.py index bbbc0d1034e5..c56b88738c1c 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer4.py +++ b/rerun_py/tests/test_types/datatypes/affix_fuzzer4.py @@ -9,13 +9,13 @@ import pyarrow as pa from attrs import define, field - -from .. import datatypes -from .._baseclasses import ( +from rerun._baseclasses import ( BaseExtensionArray, BaseExtensionType, ) +from .. import datatypes + __all__ = ["AffixFuzzer4", "AffixFuzzer4Array", "AffixFuzzer4ArrayLike", "AffixFuzzer4Like", "AffixFuzzer4Type"] diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer5.py b/rerun_py/tests/test_types/datatypes/affix_fuzzer5.py similarity index 99% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer5.py rename to rerun_py/tests/test_types/datatypes/affix_fuzzer5.py index 7d25c553ad87..e1ba19713a57 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/affix_fuzzer5.py +++ b/rerun_py/tests/test_types/datatypes/affix_fuzzer5.py @@ -9,13 +9,13 @@ import pyarrow as pa from attrs import define, field - -from .. import datatypes -from .._baseclasses import ( +from rerun._baseclasses import ( BaseExtensionArray, BaseExtensionType, ) +from .. import datatypes + __all__ = ["AffixFuzzer5", "AffixFuzzer5Array", "AffixFuzzer5ArrayLike", "AffixFuzzer5Like", "AffixFuzzer5Type"] diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/flattened_scalar.py b/rerun_py/tests/test_types/datatypes/flattened_scalar.py similarity index 98% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/flattened_scalar.py rename to rerun_py/tests/test_types/datatypes/flattened_scalar.py index 1ad56f20d93b..54489df88cdd 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/flattened_scalar.py +++ b/rerun_py/tests/test_types/datatypes/flattened_scalar.py @@ -11,8 +11,7 @@ import numpy.typing as npt import pyarrow as pa from attrs import define, field - -from .._baseclasses import ( +from rerun._baseclasses import ( BaseExtensionArray, BaseExtensionType, ) diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/primitive_component.py b/rerun_py/tests/test_types/datatypes/primitive_component.py similarity index 98% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/primitive_component.py rename to rerun_py/tests/test_types/datatypes/primitive_component.py index 1a08e199819a..18471ed87b3c 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/primitive_component.py +++ b/rerun_py/tests/test_types/datatypes/primitive_component.py @@ -11,8 +11,7 @@ import numpy.typing as npt import pyarrow as pa from attrs import define, field - -from .._baseclasses import ( +from rerun._baseclasses import ( BaseExtensionArray, BaseExtensionType, ) diff --git a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/string_component.py b/rerun_py/tests/test_types/datatypes/string_component.py similarity index 98% rename from rerun_py/rerun_sdk/rerun/_rerun2/datatypes/string_component.py rename to rerun_py/tests/test_types/datatypes/string_component.py index c4b838bb777c..9cde72582f7c 100644 --- a/rerun_py/rerun_sdk/rerun/_rerun2/datatypes/string_component.py +++ b/rerun_py/tests/test_types/datatypes/string_component.py @@ -9,8 +9,7 @@ import pyarrow as pa from attrs import define, field - -from .._baseclasses import ( +from rerun._baseclasses import ( BaseExtensionArray, BaseExtensionType, )