Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def test_no_get_logger():
"",
"If the usage is legitimate (e.g. standalone script, logging "
"infrastructure, or third-party logger suppression), add it to the "
"WHITELIST in dimos/project/test_get_logger.py.",
"WHITELIST in dimos/codebase_checks/test_get_logger.py.",
"",
]
for path, lineno, text in violations:
Expand Down
56 changes: 56 additions & 0 deletions dimos/codebase_checks/test_no_all.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Copyright 2026 Dimensional Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import ast
from pathlib import Path

from dimos.constants import DIMOS_PROJECT_ROOT


def _is_all(target: ast.expr) -> bool:
return isinstance(target, ast.Name) and target.id == "__all__"


def _defines_all(node: ast.AST) -> bool:
if isinstance(node, ast.Assign):
return any(_is_all(t) for t in node.targets)
if isinstance(node, (ast.AnnAssign, ast.AugAssign)):
return _is_all(node.target)
return False


def find_all_definitions() -> list[tuple[Path, int]]:
"""Return (file, line_number) for every `__all__` binding under dimos/."""
dimos_dir = DIMOS_PROJECT_ROOT / "dimos"
hits: list[tuple[Path, int]] = []
for path in sorted(dimos_dir.rglob("*.py")):
tree = ast.parse(path.read_text(encoding="utf-8"))
for node in ast.walk(tree):
if _defines_all(node):
hits.append((path, node.lineno))
return hits


def test_no_all():
"""Fail if any file defines `__all__`."""
dimos_dir = DIMOS_PROJECT_ROOT / "dimos"
hits = find_all_definitions()
if hits:
listing = "\n".join(f" - {p.relative_to(dimos_dir)}:{lineno}" for p, lineno in hits)
raise AssertionError(
f"Found __all__ definition(s) in dimos/:\n{listing}\n\n"
"__all__ is not allowed. We don't use `from x import *`, so __all__ "
"lists serve no purpose and are tedious to maintain. Remove them. For "
"an import that exists purely to be re-exported, use `# noqa: F401`."
)
18 changes: 0 additions & 18 deletions dimos/control/blueprints/_hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,21 +207,3 @@ def mock_twist_base(hw_id: str = "base") -> HardwareComponent:
joints=make_twist_base_joints(hw_id),
adapter_type="mock_twist_base",
)


__all__ = [
"A750_FK_MODEL",
"PIPER_FK_MODEL",
"PIPER_SIM_PATH",
"XARM6_FK_MODEL",
"XARM6_SIM_PATH",
"XARM7_FK_MODEL",
"XARM7_SIM_PATH",
"a750",
"manipulator",
"mock_arm",
"mock_twist_base",
"piper",
"xarm6",
"xarm7",
]
9 changes: 0 additions & 9 deletions dimos/control/blueprints/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,3 @@ def _mujoco_if_sim(sim_path: str, dof: int) -> tuple[Blueprint, ...]:
),
*_mujoco_if_sim(str(PIPER_SIM_PATH), len(_piper_hw.joints)),
)


__all__ = [
"coordinator_basic",
"coordinator_mock",
"coordinator_piper",
"coordinator_xarm6",
"coordinator_xarm7",
]
7 changes: 0 additions & 7 deletions dimos/control/blueprints/dual.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,3 @@
),
],
)


__all__ = [
"coordinator_dual_mock",
"coordinator_dual_xarm",
"coordinator_piper_xarm",
]
9 changes: 0 additions & 9 deletions dimos/control/blueprints/mobile.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,3 @@ def _flowbase_twist_base(
),
],
).remappings([(ControlCoordinator, "twist_command", "cmd_vel")])


__all__ = [
"coordinator_flowbase",
"coordinator_flowbase_keyboard_teleop",
"coordinator_flowbase_nav",
"coordinator_mobile_manip_mock",
"coordinator_mock_twist_base",
]
13 changes: 0 additions & 13 deletions dimos/control/blueprints/teleop.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,16 +262,3 @@ def _mujoco_if_sim(sim_path: str, dof: int) -> tuple[Blueprint, ...]:
),
],
)


__all__ = [
"coordinator_cartesian_ik_mock",
"coordinator_cartesian_ik_piper",
"coordinator_combined_xarm6",
"coordinator_servo_xarm6",
"coordinator_teleop_dual",
"coordinator_teleop_piper",
"coordinator_teleop_xarm6",
"coordinator_teleop_xarm7",
"coordinator_velocity_xarm6",
]
16 changes: 0 additions & 16 deletions dimos/control/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,19 +201,3 @@ def make_humanoid_joints(hardware_id: HardwareId) -> list[JointName]:
List of 29 joint names like ["g1/left_hip_pitch", ..., "g1/right_wrist_yaw"]
"""
return [f"{hardware_id}/{j}" for j in _HUMANOID_29DOF_JOINTS]


__all__ = [
"TWIST_SUFFIX_MAP",
"HardwareComponent",
"HardwareId",
"HardwareType",
"JointName",
"JointState",
"TaskName",
"make_gripper_joints",
"make_humanoid_joints",
"make_joints",
"make_twist_base_joints",
"split_joint_name",
]
7 changes: 0 additions & 7 deletions dimos/control/hardware_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,10 +445,3 @@ def _try_initialize_last_commanded(self) -> bool:
self._last_commanded[name] = states[i].q
self._initialized = True
return True


__all__ = [
"ConnectedHardware",
"ConnectedTwistBase",
"ConnectedWholeBody",
]
16 changes: 1 addition & 15 deletions dimos/control/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from typing import TYPE_CHECKING, Protocol, runtime_checkable

from dimos.control.components import JointName
from dimos.hardware.manipulators.spec import ControlMode
from dimos.hardware.manipulators.spec import ControlMode as ControlMode
from dimos.hardware.whole_body.spec import IMUState

if TYPE_CHECKING:
Expand Down Expand Up @@ -326,17 +326,3 @@ def set_target_by_name(self, positions: dict[str, float], t_now: float) -> bool:
def set_velocities_by_name(self, velocities: dict[str, float], t_now: float) -> bool:
"""No-op default."""
return False


__all__ = [
# Protocol + Base
"BaseControlTask",
# Types
"ControlMode",
"ControlTask",
"CoordinatorState",
"JointCommandOutput",
"JointName",
"JointStateSnapshot",
"ResourceClaim",
]
6 changes: 0 additions & 6 deletions dimos/control/tasks/cartesian_ik_task/cartesian_ik_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,6 @@ def forward_kinematics(self, joint_positions: NDArray[np.floating[Any]]) -> pino
return self._ik.forward_kinematics(joint_positions)


__all__ = [
"CartesianIKTask",
"CartesianIKTaskConfig",
]


class CartesianIKTaskParams(BaseConfig):
model_path: str | Path
ee_joint_id: int = 6
Expand Down
12 changes: 0 additions & 12 deletions dimos/control/tasks/g1_groot_wbc_task/g1_groot_wbc_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -734,18 +734,6 @@ def _projected_gravity(quaternion: tuple[float, ...]) -> NDArray[np.float32]:
return np.array([gx, gy, gz], dtype=np.float32)


__all__ = [
"ARM_DEFAULT_POSE",
"G1_GROOT_KD",
"G1_GROOT_KP",
"G1GrootWBCTask",
"G1GrootWBCTaskConfig",
"g1_arms",
"g1_joints",
"g1_legs_waist",
]


class G1GrootWBCTaskParams(BaseConfig):
model_path: str | Path
hardware_id: str
Expand Down
2 changes: 0 additions & 2 deletions dimos/control/tasks/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,5 +131,3 @@ def _resolve_factory(self, key: str) -> TaskFactory:


control_task_registry = ControlTaskRegistry()

__all__ = ["ControlTaskRegistry", "TaskFactory", "control_task_registry"]
6 changes: 0 additions & 6 deletions dimos/control/tasks/servo_task/servo_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,12 +253,6 @@ def is_streaming(self) -> bool:
return self._active and self._target is not None


__all__ = [
"JointServoTask",
"JointServoTaskConfig",
]


class JointServoTaskParams(BaseConfig):
timeout: float | None = None
default_positions: list[float] | None = None
Expand Down
6 changes: 0 additions & 6 deletions dimos/control/tasks/teleop_task/teleop_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,12 +354,6 @@ def stop(self) -> None:
logger.info(f"TeleopIKTask {self._name} stopped")


__all__ = [
"TeleopIKTask",
"TeleopIKTaskConfig",
]


class TeleopIKTaskParams(BaseConfig):
model_path: str | Path
ee_joint_id: int = 6
Expand Down
7 changes: 0 additions & 7 deletions dimos/control/tasks/trajectory_task/trajectory_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,6 @@ def get_progress(self, t_now: float) -> float:
return min(1.0, t_elapsed / self._trajectory.duration)


__all__ = [
"JointTrajectoryTask",
"JointTrajectoryTaskConfig",
"TrajectoryState",
]


def create_task(cfg: Any, hardware: Any) -> JointTrajectoryTask:
return JointTrajectoryTask(
cfg.name,
Expand Down
6 changes: 0 additions & 6 deletions dimos/control/tasks/velocity_task/velocity_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,6 @@ def is_streaming(self) -> bool:
return self._active and self._velocities is not None and not self._timed_out


__all__ = [
"JointVelocityTask",
"JointVelocityTaskConfig",
]


class JointVelocityTaskParams(BaseConfig):
timeout: float = 0.2
zero_on_timeout: bool = True
Expand Down
3 changes: 0 additions & 3 deletions dimos/control/tick_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,3 @@ def _publish_joint_state(self, snapshot: JointStateSnapshot) -> None:
)
if self._publish_callback:
self._publish_callback(msg)


__all__ = ["TickLoop"]
7 changes: 0 additions & 7 deletions dimos/core/native_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,10 +468,3 @@ def _collect_topics(self) -> dict[str, str]:
if topic is not None:
topics[name] = str(topic)
return topics


__all__ = [
"LogFormat",
"NativeModule",
"NativeModuleConfig",
]
2 changes: 0 additions & 2 deletions dimos/core/tests/stress_test_blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,3 @@
StressTestModule.blueprint(),
McpServer.blueprint(),
)

__all__ = ["demo_mcp_stress_test"]
3 changes: 0 additions & 3 deletions dimos/hardware/drive_trains/flowbase/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,3 @@ def _send_velocity(self, vx: float, vy: float, wz: float) -> bool:
def register(registry: TwistBaseAdapterRegistry) -> None:
"""Register this adapter with the registry."""
registry.register("flowbase", FlowBaseAdapter)


__all__ = ["FlowBaseAdapter"]
3 changes: 0 additions & 3 deletions dimos/hardware/drive_trains/mock/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,3 @@ def set_velocities_directly(self, velocities: list[float]) -> None:
def register(registry: TwistBaseAdapterRegistry) -> None:
"""Register this adapter with the registry."""
registry.register("mock_twist_base", MockTwistBaseAdapter)


__all__ = ["MockTwistBaseAdapter"]
2 changes: 0 additions & 2 deletions dimos/hardware/drive_trains/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,3 @@ def discover(self) -> None:

twist_base_adapter_registry = TwistBaseAdapterRegistry()
twist_base_adapter_registry.discover()

__all__ = ["TwistBaseAdapterRegistry", "twist_base_adapter_registry"]
5 changes: 0 additions & 5 deletions dimos/hardware/drive_trains/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,3 @@ def write_enable(self, enable: bool) -> bool:
def read_enabled(self) -> bool:
"""Check if platform is enabled."""
...


__all__ = [
"TwistBaseAdapter",
]
3 changes: 0 additions & 3 deletions dimos/hardware/drive_trains/transport/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,3 @@ def register(registry: TwistBaseAdapterRegistry) -> None:

registry.register("transport_lcm", partial(TransportTwistAdapter, transport_cls=LCMTransport))
registry.register("transport_ros", partial(TransportTwistAdapter, transport_cls=ROSTransport))


__all__ = ["TransportTwistAdapter"]
3 changes: 0 additions & 3 deletions dimos/hardware/drive_trains/unitree_go2/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,3 @@ def _send_velocity(self, vx: float, vy: float, wz: float) -> bool:

def register(registry: TwistBaseAdapterRegistry) -> None:
registry.register("unitree_go2", UnitreeGo2TwistAdapter)


__all__ = ["UnitreeGo2TwistAdapter"]
3 changes: 0 additions & 3 deletions dimos/hardware/manipulators/a750/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,3 @@ def _trace(self, method: str, **kwargs: object) -> None:
def register(registry: AdapterRegistry) -> None:
"""Register this adapter with the registry."""
registry.register("a750", A750Adapter)


__all__ = ["A750Adapter"]
3 changes: 0 additions & 3 deletions dimos/hardware/manipulators/mock/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,3 @@ def set_efforts(self, efforts: list[float]) -> None:
def register(registry: AdapterRegistry) -> None:
"""Register this adapter with the registry."""
registry.register("mock", MockAdapter)


__all__ = ["MockAdapter"]
3 changes: 0 additions & 3 deletions dimos/hardware/manipulators/openarm/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,3 @@ def read_force_torque(self) -> list[float] | None:
# ── Registry hook (required for auto-discovery) ───────────────────
def register(registry: AdapterRegistry) -> None:
registry.register("openarm", OpenArmAdapter)


__all__ = ["OpenArmAdapter", "register"]
Loading
Loading