refactor(worker): defer optional visualization imports
This commit is contained in:
@@ -1,5 +1,9 @@
|
|||||||
"""Host-owned compute handoff contracts."""
|
"""Host-owned compute handoff contracts."""
|
||||||
|
|
||||||
|
from importlib import import_module
|
||||||
|
from typing import TYPE_CHECKING, Any, Final
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from .annotation_workspace import (
|
from .annotation_workspace import (
|
||||||
ANNOTATION_WORKSPACE_SCHEMA,
|
ANNOTATION_WORKSPACE_SCHEMA,
|
||||||
AnnotationWorkspace,
|
AnnotationWorkspace,
|
||||||
@@ -495,3 +499,376 @@ __all__ = [
|
|||||||
"sensor_frame_xyzi",
|
"sensor_frame_xyzi",
|
||||||
"verify_lidar_replay_equivalence",
|
"verify_lidar_replay_equivalence",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
_EXPORTS: Final[dict[str, str]] = {
|
||||||
|
**dict.fromkeys(
|
||||||
|
(
|
||||||
|
"ANNOTATION_WORKSPACE_SCHEMA",
|
||||||
|
"AnnotationWorkspace",
|
||||||
|
"AnnotationWorkspaceError",
|
||||||
|
"prepare_annotation_workspace",
|
||||||
|
"validate_annotation_workspace",
|
||||||
|
),
|
||||||
|
".annotation_workspace",
|
||||||
|
),
|
||||||
|
**dict.fromkeys(
|
||||||
|
(
|
||||||
|
"DEFAULT_E31_SOURCE_QUALIFICATION_PROFILE",
|
||||||
|
"E31_BINDING_PROFILE_SCHEMA",
|
||||||
|
"E31_SOURCE_QUALIFICATION_REPORT_SCHEMA",
|
||||||
|
"E31_SOURCE_QUALIFICATION_SCHEMA",
|
||||||
|
"E31SourceQualification",
|
||||||
|
"E31SourceQualificationError",
|
||||||
|
"E31SourceQualificationProfile",
|
||||||
|
"build_e31_source_qualification",
|
||||||
|
),
|
||||||
|
".e31_source_qualification",
|
||||||
|
),
|
||||||
|
**dict.fromkeys(
|
||||||
|
(
|
||||||
|
"E32_TRACK_GEOMETRY_RECORD_SCHEMA",
|
||||||
|
"E32_TRACK_GEOMETRY_REPLAY_SCHEMA",
|
||||||
|
"E32_TRACK_GEOMETRY_REPORT_SCHEMA",
|
||||||
|
"E32TrackGeometryReplay",
|
||||||
|
"E32TrackGeometryReplayError",
|
||||||
|
"build_e32_track_geometry_replay",
|
||||||
|
"e32_track_geometry_frame",
|
||||||
|
"read_e32_track_geometry_replay",
|
||||||
|
),
|
||||||
|
".e32_track_geometry_replay",
|
||||||
|
),
|
||||||
|
**dict.fromkeys(
|
||||||
|
(
|
||||||
|
"E33_FRAME_SCHEMA",
|
||||||
|
"E33_OUTCOME_SCHEMA",
|
||||||
|
"E33_PACKAGE_SCHEMA",
|
||||||
|
"E33_PROFILE_SCHEMA",
|
||||||
|
"E33_REPORT_SCHEMA",
|
||||||
|
"E33_RESOURCE_SCHEMA",
|
||||||
|
"E33_RESULT_SCHEMA",
|
||||||
|
"E33WorkerShadowError",
|
||||||
|
"E33WorkerShadowResult",
|
||||||
|
"read_e33_worker_shadow_result",
|
||||||
|
"run_e33_worker_shadow",
|
||||||
|
),
|
||||||
|
".e33_worker_shadow",
|
||||||
|
),
|
||||||
|
**dict.fromkeys(
|
||||||
|
(
|
||||||
|
"E51_FRAME_SCHEMA",
|
||||||
|
"E51_PROFILE_SCHEMA",
|
||||||
|
"E51_REPORT_SCHEMA",
|
||||||
|
"E51_RESULT_SCHEMA",
|
||||||
|
"E51_SIGNAL_SCHEMA",
|
||||||
|
"E51MotionSemanticError",
|
||||||
|
"E51MotionSemanticResult",
|
||||||
|
"build_e51_motion_semantic_qualification",
|
||||||
|
"derive_motion_semantic_signal",
|
||||||
|
"read_e51_motion_semantic_qualification",
|
||||||
|
),
|
||||||
|
".e51_motion_semantic_qualification",
|
||||||
|
),
|
||||||
|
**dict.fromkeys(
|
||||||
|
(
|
||||||
|
"E52_CASE_SCHEMA",
|
||||||
|
"E52_PROFILE_SCHEMA",
|
||||||
|
"E52_REPORT_SCHEMA",
|
||||||
|
"E52_RESULT_SCHEMA",
|
||||||
|
"E52CameraFirstRestoration",
|
||||||
|
"E52CameraFirstRestorationError",
|
||||||
|
"build_e52_camera_first_restoration",
|
||||||
|
"evaluate_camera_first_case",
|
||||||
|
"read_e52_camera_first_restoration",
|
||||||
|
),
|
||||||
|
".e52_camera_first_restoration",
|
||||||
|
),
|
||||||
|
**dict.fromkeys(
|
||||||
|
(
|
||||||
|
"ANNOTATION_CONTRACT_SCHEMA",
|
||||||
|
"EVALUATION_PACK_SCHEMA",
|
||||||
|
"EvaluationFrameRequest",
|
||||||
|
"EvaluationPackFrame",
|
||||||
|
"RecordedEvaluationPack",
|
||||||
|
"RecordedEvaluationPackError",
|
||||||
|
"prepare_recorded_evaluation_pack",
|
||||||
|
"validate_recorded_evaluation_pack",
|
||||||
|
),
|
||||||
|
".evaluation_pack",
|
||||||
|
),
|
||||||
|
**dict.fromkeys(
|
||||||
|
(
|
||||||
|
"RecordedCalibratedFusion",
|
||||||
|
"RecordedCalibratedFusionStore",
|
||||||
|
"RecordedPerceptionOverlayMux",
|
||||||
|
"validate_recorded_calibrated_fusion",
|
||||||
|
),
|
||||||
|
".fusion_epoch",
|
||||||
|
),
|
||||||
|
**dict.fromkeys(
|
||||||
|
(
|
||||||
|
"IntegratedPerceptionOverlayStore",
|
||||||
|
"IntegratedPerceptionResult",
|
||||||
|
"validate_integrated_perception_result",
|
||||||
|
),
|
||||||
|
".integrated_perception",
|
||||||
|
),
|
||||||
|
**dict.fromkeys(
|
||||||
|
(
|
||||||
|
"COMPUTE_JOB_SCHEMA",
|
||||||
|
"CameraComputeJob",
|
||||||
|
"prepare_camera_compute_job",
|
||||||
|
"validate_camera_compute_job",
|
||||||
|
),
|
||||||
|
".jobs",
|
||||||
|
),
|
||||||
|
**dict.fromkeys(
|
||||||
|
(
|
||||||
|
"PublishedCameraEgoMotionLabInstance",
|
||||||
|
"PublishedIntegratedLabInstance",
|
||||||
|
"PublishedPersistentSupportLabInstance",
|
||||||
|
"PublishedTemporalLabInstance",
|
||||||
|
"PublishedWorldMotionLabInstance",
|
||||||
|
"publish_e21_lab_instance",
|
||||||
|
"publish_e22_lab_instance",
|
||||||
|
"publish_e23_lab_instance",
|
||||||
|
"publish_e24_lab_instance",
|
||||||
|
"publish_e25_lab_instance",
|
||||||
|
"publish_e26_lab_instance",
|
||||||
|
"publish_integrated_lab_instance",
|
||||||
|
),
|
||||||
|
".lab_instances",
|
||||||
|
),
|
||||||
|
**dict.fromkeys(
|
||||||
|
(
|
||||||
|
"K1_LAB_LIDAR_PACK_V1_PROFILE",
|
||||||
|
"K1_LIDAR_PACK_V2_PROFILE",
|
||||||
|
"K1_LIVE_LIDAR_PROFILE",
|
||||||
|
"LIDAR_EVIDENCE_PROFILE_SCHEMA",
|
||||||
|
"LIDAR_READINESS_SCHEMA",
|
||||||
|
"LidarContractError",
|
||||||
|
"LidarCoordinateSpace",
|
||||||
|
"LidarEvidenceProfile",
|
||||||
|
"LidarPipelineStage",
|
||||||
|
"LidarPointField",
|
||||||
|
"LidarPoseStatus",
|
||||||
|
"LidarQualityMonitor",
|
||||||
|
"LidarReadiness",
|
||||||
|
"LidarRepresentation",
|
||||||
|
"LidarStageAssessment",
|
||||||
|
"LidarTimeBasis",
|
||||||
|
"assess_lidar_profile",
|
||||||
|
"lidar_readiness_document",
|
||||||
|
"sensor_frame_xyzi",
|
||||||
|
),
|
||||||
|
".lidar_contract",
|
||||||
|
),
|
||||||
|
**dict.fromkeys(
|
||||||
|
(
|
||||||
|
"E10_LIDAR_PACK_SCHEMA",
|
||||||
|
"FIELD_REVIEW_ARRAYS_NAME",
|
||||||
|
"FIELD_REVIEW_MANIFEST_NAME",
|
||||||
|
"FIELD_REVIEW_REPORT_NAME",
|
||||||
|
"LIDAR_FIELD_REVIEW_REPORT_SCHEMA",
|
||||||
|
"LIDAR_FIELD_REVIEW_SCHEMA",
|
||||||
|
"LIDAR_FIELD_REVIEW_WINDOW_SCHEMA",
|
||||||
|
"MAX_FIELD_REVIEW_WINDOW_POINTS",
|
||||||
|
"RAVNOVES00_CENTRAL_WINDOWS",
|
||||||
|
"E10LidarFieldSource",
|
||||||
|
"FieldReviewWindowSpec",
|
||||||
|
"LidarFieldReviewV1",
|
||||||
|
"build_lidar_field_review",
|
||||||
|
"lidar_field_review_catalog_item",
|
||||||
|
),
|
||||||
|
".lidar_field_review",
|
||||||
|
),
|
||||||
|
**dict.fromkeys(
|
||||||
|
(
|
||||||
|
"DEFAULT_GROUND_BENCHMARK_PROFILE",
|
||||||
|
"LIDAR_GROUND_ANNOTATION_TEMPLATE_SCHEMA",
|
||||||
|
"LIDAR_GROUND_BENCHMARK_REPORT_SCHEMA",
|
||||||
|
"LIDAR_GROUND_BENCHMARK_SCHEMA",
|
||||||
|
"LIDAR_GROUND_FRAME_SCHEMA",
|
||||||
|
"PATCHWORKPP_SOURCE_COMMIT",
|
||||||
|
"PATCHWORKPP_SOURCE_TAG",
|
||||||
|
"PATCHWORKPP_SOURCE_URL",
|
||||||
|
"GroundBenchmarkProfile",
|
||||||
|
"GroundSegmentation",
|
||||||
|
"LidarGroundBenchmarkV1",
|
||||||
|
"LidarGroundError",
|
||||||
|
"LocalPercentileGroundSegmenter",
|
||||||
|
"PatchworkPPGroundSegmenter",
|
||||||
|
"build_lidar_ground_annotation_template",
|
||||||
|
"build_lidar_ground_benchmark",
|
||||||
|
"lidar_ground_benchmark_catalog_item",
|
||||||
|
"lidar_ground_frame_detail",
|
||||||
|
"score_ground_labels",
|
||||||
|
),
|
||||||
|
".lidar_ground",
|
||||||
|
),
|
||||||
|
**dict.fromkeys(
|
||||||
|
(
|
||||||
|
"DEFAULT_K1_LOCAL_SURFACE_PROFILE",
|
||||||
|
"K1_LOCAL_SURFACE_FRAME_SCHEMA",
|
||||||
|
"K1_LOCAL_SURFACE_REPORT_SCHEMA",
|
||||||
|
"K1_LOCAL_SURFACE_REVIEW_SCHEMA",
|
||||||
|
"K1_LOCAL_SURFACE_SCHEMA",
|
||||||
|
"K1_LOCAL_SURFACE_TIMELINE_SCHEMA",
|
||||||
|
"K1LocalSurfaceProfile",
|
||||||
|
"K1LocalSurfaceV1",
|
||||||
|
"build_k1_local_surface",
|
||||||
|
"k1_local_surface_catalog_item",
|
||||||
|
),
|
||||||
|
".lidar_local_surface",
|
||||||
|
),
|
||||||
|
**dict.fromkeys(
|
||||||
|
(
|
||||||
|
"K1_LOCAL_SURFACE_BINDER_SCHEMA",
|
||||||
|
"K1_LOCAL_SURFACE_SHADOW_FRAME_SCHEMA",
|
||||||
|
"K1_LOCAL_SURFACE_SHADOW_SCHEMA",
|
||||||
|
"K1LocalSurfaceBoundViews",
|
||||||
|
"K1LocalSurfacePoseBinder",
|
||||||
|
"K1LocalSurfaceShadowCoordinator",
|
||||||
|
"K1LocalSurfaceShadowEstimator",
|
||||||
|
"K1LocalSurfaceShadowInput",
|
||||||
|
"K1LocalSurfaceShadowResult",
|
||||||
|
"K1LocalSurfaceShadowRuntime",
|
||||||
|
),
|
||||||
|
".lidar_local_surface_shadow",
|
||||||
|
),
|
||||||
|
**dict.fromkeys(
|
||||||
|
(
|
||||||
|
"LIDAR_EQUIVALENCE_REPORT_SCHEMA",
|
||||||
|
"LIDAR_QUALITY_REPORT_SCHEMA",
|
||||||
|
"LIDAR_REPLAY_PACK_SCHEMA",
|
||||||
|
"LidarReplayError",
|
||||||
|
"LidarReplayPackV2",
|
||||||
|
"LidarReplayPointFrame",
|
||||||
|
"LidarReplayPoseFrame",
|
||||||
|
"build_lidar_replay_pack_v2",
|
||||||
|
"lidar_pack_catalog_item",
|
||||||
|
"lidar_pack_detail",
|
||||||
|
"verify_lidar_replay_equivalence",
|
||||||
|
),
|
||||||
|
".lidar_replay",
|
||||||
|
),
|
||||||
|
**dict.fromkeys(
|
||||||
|
(
|
||||||
|
"LIVE_INGRESS_SCHEMA",
|
||||||
|
"LIVE_INGRESS_WIRE_SCHEMA",
|
||||||
|
"TELEMETRY_SCHEMA",
|
||||||
|
"WORLD_STATE_SCHEMA",
|
||||||
|
"LatestWinsQueue",
|
||||||
|
"LiveIngressEvent",
|
||||||
|
"LivePerceptionIngress",
|
||||||
|
"QueueSnapshot",
|
||||||
|
"WorldStateProjector",
|
||||||
|
"classify_health",
|
||||||
|
),
|
||||||
|
".live_perception",
|
||||||
|
),
|
||||||
|
**dict.fromkeys(
|
||||||
|
(
|
||||||
|
"LiveReplayQualificationResult",
|
||||||
|
"validate_live_replay_qualification_result",
|
||||||
|
),
|
||||||
|
".live_replay_qualification",
|
||||||
|
),
|
||||||
|
**dict.fromkeys(
|
||||||
|
(
|
||||||
|
"MultiratePerceptionArtifact",
|
||||||
|
"MultiratePerceptionQualificationResult",
|
||||||
|
"validate_multirate_perception_qualification_result",
|
||||||
|
),
|
||||||
|
".multirate_perception_qualification",
|
||||||
|
),
|
||||||
|
**dict.fromkeys(
|
||||||
|
(
|
||||||
|
"RecordedPerceptionEpochResult",
|
||||||
|
"RecordedPerceptionEpochStore",
|
||||||
|
"RecordedPerceptionVideo",
|
||||||
|
"validate_recorded_perception_epoch_result",
|
||||||
|
),
|
||||||
|
".perception_epoch",
|
||||||
|
),
|
||||||
|
**dict.fromkeys(
|
||||||
|
(
|
||||||
|
"DEFAULT_QUALIFICATION_FRAME_COUNT",
|
||||||
|
"QUALIFICATION_POLICY",
|
||||||
|
"QualificationFrame",
|
||||||
|
"RecordedQualificationSlice",
|
||||||
|
"RecordedQualificationSliceError",
|
||||||
|
"prepare_recorded_qualification_slice",
|
||||||
|
"validate_recorded_qualification_slice",
|
||||||
|
),
|
||||||
|
".qualification",
|
||||||
|
),
|
||||||
|
**dict.fromkeys(
|
||||||
|
(
|
||||||
|
"RealtimeTrackingArtifact",
|
||||||
|
"RealtimeTrackingQualificationResult",
|
||||||
|
"validate_realtime_tracking_qualification_result",
|
||||||
|
),
|
||||||
|
".realtime_tracking_qualification",
|
||||||
|
),
|
||||||
|
**dict.fromkeys(
|
||||||
|
(
|
||||||
|
"DetectionFrame",
|
||||||
|
"ObjectDetection",
|
||||||
|
"RecordedPerceptionOverlayArtifact",
|
||||||
|
"RecordedPerceptionOverlayError",
|
||||||
|
"RecordedPerceptionOverlayStore",
|
||||||
|
"RecordedPerceptionResult",
|
||||||
|
"validate_recorded_perception_result",
|
||||||
|
),
|
||||||
|
".results",
|
||||||
|
),
|
||||||
|
**dict.fromkeys(
|
||||||
|
(
|
||||||
|
"POINT_SLAB_SCHEMA",
|
||||||
|
"TRACK_GEOMETRY_BINDING_SCHEMA",
|
||||||
|
"TRACK_GEOMETRY_FRAME_SCHEMA",
|
||||||
|
"TRACK_GEOMETRY_SCHEMA",
|
||||||
|
"PointSlab",
|
||||||
|
"TrackGeometry",
|
||||||
|
"TrackGeometryContractError",
|
||||||
|
"TrackGeometryCurrentness",
|
||||||
|
"TrackGeometryEvidenceState",
|
||||||
|
"TrackGeometryFrame",
|
||||||
|
"TrackGeometryMetricBasis",
|
||||||
|
"TrackGeometryOwnerKind",
|
||||||
|
"TrackGeometrySourceBinding",
|
||||||
|
),
|
||||||
|
".track_geometry",
|
||||||
|
),
|
||||||
|
**dict.fromkeys(
|
||||||
|
(
|
||||||
|
"TrackedFusionQualificationResult",
|
||||||
|
"validate_tracked_fusion_qualification_result",
|
||||||
|
),
|
||||||
|
".tracked_fusion_qualification",
|
||||||
|
),
|
||||||
|
**dict.fromkeys(
|
||||||
|
(
|
||||||
|
"TrackingQualificationArtifact",
|
||||||
|
"TrackingQualificationResult",
|
||||||
|
"validate_tracking_qualification_result",
|
||||||
|
),
|
||||||
|
".tracking_qualification",
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
if set(_EXPORTS) != set(__all__) or len(_EXPORTS) != len(__all__):
|
||||||
|
raise RuntimeError("compute lazy export table does not match __all__")
|
||||||
|
|
||||||
|
|
||||||
|
def __getattr__(name: str) -> Any:
|
||||||
|
module_name = _EXPORTS.get(name)
|
||||||
|
if module_name is None:
|
||||||
|
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
||||||
|
value: Any = getattr(import_module(module_name, __name__), name)
|
||||||
|
globals()[name] = value
|
||||||
|
return value
|
||||||
|
|
||||||
|
|
||||||
|
def __dir__() -> list[str]:
|
||||||
|
return sorted({*globals(), *__all__})
|
||||||
|
|||||||
@@ -1,5 +1,30 @@
|
|||||||
"""XGRIDS/LixelKity K1 compatibility plugin implementation."""
|
"""XGRIDS/LixelKity K1 compatibility plugin implementation."""
|
||||||
|
|
||||||
|
from importlib import import_module
|
||||||
|
from typing import TYPE_CHECKING, Any, Final
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from .observation import build_xgrids_k1_observation, xgrids_k1_archive_source
|
from .observation import build_xgrids_k1_observation, xgrids_k1_archive_source
|
||||||
|
|
||||||
__all__ = ["build_xgrids_k1_observation", "xgrids_k1_archive_source"]
|
__all__ = ["build_xgrids_k1_observation", "xgrids_k1_archive_source"]
|
||||||
|
|
||||||
|
_EXPORTS: Final = {
|
||||||
|
"build_xgrids_k1_observation": ".observation",
|
||||||
|
"xgrids_k1_archive_source": ".observation",
|
||||||
|
}
|
||||||
|
|
||||||
|
if set(_EXPORTS) != set(__all__) or len(_EXPORTS) != len(__all__):
|
||||||
|
raise RuntimeError("XGRIDS K1 lazy export table does not match __all__")
|
||||||
|
|
||||||
|
|
||||||
|
def __getattr__(name: str) -> Any:
|
||||||
|
module_name = _EXPORTS.get(name)
|
||||||
|
if module_name is None:
|
||||||
|
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
||||||
|
value: Any = getattr(import_module(module_name, __name__), name)
|
||||||
|
globals()[name] = value
|
||||||
|
return value
|
||||||
|
|
||||||
|
|
||||||
|
def __dir__() -> list[str]:
|
||||||
|
return sorted({*globals(), *__all__})
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
"""Bounded, offline analysis of sensitive K1 evidence artifacts."""
|
"""Bounded, offline analysis of sensitive K1 evidence artifacts."""
|
||||||
|
|
||||||
|
from importlib import import_module
|
||||||
|
from typing import TYPE_CHECKING, Any, Final
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
from k1link.device_plugins.xgrids_k1.analyze.calibrated_overlay import (
|
from k1link.device_plugins.xgrids_k1.analyze.calibrated_overlay import (
|
||||||
CalibratedOverlayExperiment,
|
CalibratedOverlayExperiment,
|
||||||
CalibratedOverlayExperimentError,
|
CalibratedOverlayExperimentError,
|
||||||
@@ -51,3 +55,62 @@ __all__ = [
|
|||||||
"unproject_pixels_kb4",
|
"unproject_pixels_kb4",
|
||||||
"validate_k1_valid_fov_mask",
|
"validate_k1_valid_fov_mask",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
_EXPORTS: Final = {
|
||||||
|
**dict.fromkeys(
|
||||||
|
(
|
||||||
|
"CalibratedOverlayExperiment",
|
||||||
|
"CalibratedOverlayExperimentError",
|
||||||
|
"run_calibrated_overlay_experiment",
|
||||||
|
),
|
||||||
|
".calibrated_overlay",
|
||||||
|
),
|
||||||
|
**dict.fromkeys(
|
||||||
|
(
|
||||||
|
"CalibratedProjectionError",
|
||||||
|
"Kb4ProjectionProfile",
|
||||||
|
"ProjectedPointCloud",
|
||||||
|
"depth_colors",
|
||||||
|
"map_points_to_lidar",
|
||||||
|
"project_map_points_kb4",
|
||||||
|
"quaternion_xyzw_to_rotation_matrix",
|
||||||
|
"unproject_pixels_kb4",
|
||||||
|
),
|
||||||
|
".calibrated_projection",
|
||||||
|
),
|
||||||
|
**dict.fromkeys(
|
||||||
|
(
|
||||||
|
"DEFAULT_STREAM_SUMMARY_MAX_PAYLOAD_BYTES",
|
||||||
|
"MAX_STREAM_SUMMARY_PAYLOAD_BYTES",
|
||||||
|
"StreamSummary",
|
||||||
|
"summarize_mqtt_streams",
|
||||||
|
),
|
||||||
|
".stream_summary",
|
||||||
|
),
|
||||||
|
**dict.fromkeys(
|
||||||
|
(
|
||||||
|
"DEFAULT_EDGE_MARGIN_PIXELS",
|
||||||
|
"K1ValidFovMask",
|
||||||
|
"K1ValidFovMaskError",
|
||||||
|
"prepare_k1_valid_fov_mask",
|
||||||
|
"validate_k1_valid_fov_mask",
|
||||||
|
),
|
||||||
|
".valid_fov",
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
if set(_EXPORTS) != set(__all__) or len(_EXPORTS) != len(__all__):
|
||||||
|
raise RuntimeError("XGRIDS K1 analysis lazy export table does not match __all__")
|
||||||
|
|
||||||
|
|
||||||
|
def __getattr__(name: str) -> Any:
|
||||||
|
module_name = _EXPORTS.get(name)
|
||||||
|
if module_name is None:
|
||||||
|
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
||||||
|
value: Any = getattr(import_module(module_name, __name__), name)
|
||||||
|
globals()[name] = value
|
||||||
|
return value
|
||||||
|
|
||||||
|
|
||||||
|
def __dir__() -> list[str]:
|
||||||
|
return sorted({*globals(), *__all__})
|
||||||
|
|||||||
@@ -0,0 +1,91 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import textwrap
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
REPOSITORY_ROOT = Path(__file__).resolve().parents[1]
|
||||||
|
SOURCE_ROOT = REPOSITORY_ROOT / "src"
|
||||||
|
|
||||||
|
|
||||||
|
def test_m49_container_import_excludes_optional_visualization_dependencies() -> None:
|
||||||
|
script = textwrap.dedent(
|
||||||
|
"""
|
||||||
|
import hashlib
|
||||||
|
import importlib.abc
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
|
||||||
|
blocked = frozenset({"PIL", "pyarrow", "rerun"})
|
||||||
|
|
||||||
|
class OptionalDependencyBlocker(importlib.abc.MetaPathFinder):
|
||||||
|
def find_spec(self, fullname, path=None, target=None):
|
||||||
|
if fullname.partition(".")[0] in blocked:
|
||||||
|
raise ModuleNotFoundError(
|
||||||
|
f"blocked optional dependency: {fullname}",
|
||||||
|
name=fullname,
|
||||||
|
)
|
||||||
|
return None
|
||||||
|
|
||||||
|
assert blocked.isdisjoint(sys.modules)
|
||||||
|
sys.meta_path.insert(0, OptionalDependencyBlocker())
|
||||||
|
|
||||||
|
import k1link.compute as compute
|
||||||
|
import k1link.device_plugins.xgrids_k1 as xgrids_k1
|
||||||
|
import k1link.device_plugins.xgrids_k1.analyze as analyze
|
||||||
|
import k1link.observatory.m49_worker_container_main as container_main
|
||||||
|
from k1link.compute import LidarReplayPackV2
|
||||||
|
from k1link.compute.lidar_replay import LidarReplayPackV2 as DirectReplayPack
|
||||||
|
from k1link.device_plugins.xgrids_k1.analyze import Kb4ProjectionProfile
|
||||||
|
from k1link.device_plugins.xgrids_k1.analyze.calibrated_projection import (
|
||||||
|
Kb4ProjectionProfile as DirectProjectionProfile,
|
||||||
|
)
|
||||||
|
|
||||||
|
expected_public_api = {
|
||||||
|
compute: (219, "a8616ca1402ee26774fb8c8ca2df12b77877305260bde2d64db75acbdc79b598"),
|
||||||
|
xgrids_k1: (2, "735cce20efdc7b1abd12006073233051c6702b00e8f15d21c2142d671061a79b"),
|
||||||
|
analyze: (20, "4a3edcb6b9c735338c0392838be0eac89cad2db1178a5ab7833c1231b6ecc4c2"),
|
||||||
|
}
|
||||||
|
for package, (length, digest) in expected_public_api.items():
|
||||||
|
payload = json.dumps(package.__all__, separators=(",", ":")).encode()
|
||||||
|
assert len(package.__all__) == length
|
||||||
|
assert hashlib.sha256(payload).hexdigest() == digest
|
||||||
|
assert set(package.__all__).issubset(dir(package))
|
||||||
|
|
||||||
|
assert LidarReplayPackV2 is DirectReplayPack
|
||||||
|
assert Kb4ProjectionProfile is DirectProjectionProfile
|
||||||
|
assert container_main.__name__ == "k1link.observatory.m49_worker_container_main"
|
||||||
|
assert "k1link.compute.fusion_epoch" not in sys.modules
|
||||||
|
assert "k1link.device_plugins.xgrids_k1.observation" not in sys.modules
|
||||||
|
assert (
|
||||||
|
"k1link.device_plugins.xgrids_k1.analyze.calibrated_overlay"
|
||||||
|
not in sys.modules
|
||||||
|
)
|
||||||
|
assert "k1link.device_plugins.xgrids_k1.analyze.valid_fov" not in sys.modules
|
||||||
|
assert all(
|
||||||
|
module.partition(".")[0] not in blocked
|
||||||
|
for module in sys.modules
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
environment = os.environ.copy()
|
||||||
|
inherited_python_path = environment.get("PYTHONPATH")
|
||||||
|
python_path = [str(SOURCE_ROOT)]
|
||||||
|
if inherited_python_path:
|
||||||
|
python_path.append(inherited_python_path)
|
||||||
|
environment["PYTHONPATH"] = os.pathsep.join(python_path)
|
||||||
|
environment["PYTHONNOUSERSITE"] = "1"
|
||||||
|
|
||||||
|
completed = subprocess.run(
|
||||||
|
[sys.executable, "-c", script],
|
||||||
|
cwd=REPOSITORY_ROOT,
|
||||||
|
env=environment,
|
||||||
|
check=False,
|
||||||
|
capture_output=True,
|
||||||
|
text=True,
|
||||||
|
timeout=30,
|
||||||
|
)
|
||||||
|
|
||||||
|
assert completed.returncode == 0, completed.stderr
|
||||||
Reference in New Issue
Block a user