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
2 changes: 1 addition & 1 deletion dimos/core/global_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from pydantic_settings import BaseSettings, SettingsConfigDict

from dimos.models.vl.create import VlModelName
from dimos.models.vl.types import VlModelName

ViewerBackend: TypeAlias = Literal["rerun", "rerun-web", "rerun-connect", "foxglove", "none"]

Expand Down
5 changes: 1 addition & 4 deletions dimos/mapping/occupancy/path_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import Literal, TypeAlias

from dimos.mapping.occupancy.gradient import GradientStrategy, gradient, voronoi_gradient
from dimos.mapping.occupancy.inflation import simple_inflate
from dimos.mapping.occupancy.operations import overlay_occupied, smooth_occupied
from dimos.mapping.occupancy.types import NavigationStrategy
from dimos.msgs.nav_msgs.OccupancyGrid import OccupancyGrid

NavigationStrategy: TypeAlias = Literal["simple", "mixed"]


def make_navigation_map(
occupancy_grid: OccupancyGrid,
Expand Down
17 changes: 17 additions & 0 deletions dimos/mapping/occupancy/types.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# 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.

from typing import Literal, TypeAlias

NavigationStrategy: TypeAlias = Literal["simple", "mixed"]
5 changes: 2 additions & 3 deletions dimos/models/vl/create.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from typing import Any, Literal
from typing import Any

from dimos.models.vl.types import VlModelName
from dimos.models.vl.base import VlModel

VlModelName = Literal["qwen", "moondream"]


def create(name: VlModelName) -> VlModel[Any]:
# This uses inline imports to only import what's needed.
Expand Down
3 changes: 3 additions & 0 deletions dimos/models/vl/types.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from typing import Literal

VlModelName = Literal["qwen", "moondream"]
63 changes: 63 additions & 0 deletions dimos/robot/cli/test_cli_startup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Copyright 2025-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.

"""Guard against import-time regressions in the CLI entrypoint.

`dimos --help` should never pull in heavy ML/viz libraries. If it does,
startup time balloons from <2s to >5s, which is a terrible UX.
"""

import subprocess
import sys
import time

# CI runners are slower — give generous headroom but still catch gross regressions.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused pytest import

pytest is imported on this line but never used in the module — no pytest.mark, pytest.raises, pytest.fixture, etc. appear anywhere. This will trigger linter warnings (e.g. F401 in flake8/ruff).

Suggested change
# CI runners are slower — give generous headroom but still catch gross regressions.

HELP_TIMEOUT_SECONDS = 8


def test_help_does_not_import_heavy_deps() -> None:
"""GlobalConfig import must not drag in matplotlib, torch, or scipy."""
result = subprocess.run(
[
sys.executable,
"-c",
(
"import sys; "
"from dimos.core.global_config import GlobalConfig; "
"bad = [m for m in ('matplotlib', 'torch', 'scipy') if m in sys.modules]; "
"assert not bad, f'Heavy deps imported: {bad}'"
),
],
capture_output=True,
text=True,
timeout=30,
)
assert result.returncode == 0, f"Heavy deps leaked into GlobalConfig import:\n{result.stderr}"


def test_help_startup_time() -> None:
"""`dimos --help` must finish in under {HELP_TIMEOUT_SECONDS}s."""
start = time.monotonic()
result = subprocess.run(
[sys.executable, "-m", "dimos.robot.cli.dimos", "--help"],
capture_output=True,
text=True,
timeout=HELP_TIMEOUT_SECONDS + 5, # hard kill safety margin
)
elapsed = time.monotonic() - start
assert result.returncode == 0, f"dimos --help failed:\n{result.stderr}"
assert elapsed < HELP_TIMEOUT_SECONDS, (
f"dimos --help took {elapsed:.1f}s (limit: {HELP_TIMEOUT_SECONDS}s). "
f"Check for heavy imports in the CLI entrypoint or GlobalConfig."
)
Loading