fix(cli): fix dimos --help (both bad imports and speed)#1571
Merged
paul-nechifor merged 7 commits intodevfrom Mar 20, 2026
Merged
fix(cli): fix dimos --help (both bad imports and speed)#1571paul-nechifor merged 7 commits intodevfrom
dimos --help (both bad imports and speed)#1571paul-nechifor merged 7 commits intodevfrom
Conversation
Move NavigationStrategy and VlModelName type aliases into dimos/core/types.py so that global_config.py no longer pulls in matplotlib/scipy (via path_map.py) or torch/langchain (via create.py) at import time. Original modules re-export from the new file so existing imports continue to work. `dimos --help` drops from ~3-4s to ~1.9s.
dc324f6 to
f98c0bd
Compare
NavigationStrategy → dimos/mapping/occupancy/types.py VlModelName → dimos/models/vl/types.py Remove dimos/core/types.py
328b69c to
0bd3622
Compare
Contributor
Greptile SummaryExtracts lightweight
Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
subgraph Before["Before (slow path)"]
CLI_OLD["dimos CLI"] --> GC_OLD["global_config.py"]
GC_OLD --> PM_OLD["path_map.py"]
PM_OLD --> SCIPY["scipy / numpy / matplotlib"]
GC_OLD --> CR_OLD["create.py"]
CR_OLD --> TORCH["torch / langchain"]
end
subgraph After["After (fast path)"]
CLI_NEW["dimos CLI"] --> GC_NEW["global_config.py"]
GC_NEW --> OT["occupancy/types.py\n(NavigationStrategy)"]
GC_NEW --> VT["vl/types.py\n(VlModelName)"]
OT -. "only typing stdlib" .-> STDLIB["typing (stdlib)"]
VT -. "only typing stdlib" .-> STDLIB
end
style SCIPY fill:#f88,stroke:#a00
style TORCH fill:#f88,stroke:#a00
style STDLIB fill:#8f8,stroke:#0a0
style OT fill:#8f8,stroke:#0a0
style VT fill:#8f8,stroke:#0a0
Last reviewed commit: 0bd3622 |
| import sys | ||
| import time | ||
|
|
||
| # CI runners are slower — give generous headroom but still catch gross regressions. |
Contributor
There was a problem hiding this comment.
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. |
dimos --help (~5s → ~2s)dimos --help (both bad imports and speed)
Guards against heavy imports (matplotlib, torch, scipy) leaking into the CLI entrypoint via GlobalConfig. Fails if dimos --help takes >8s.
8056eca to
0113d87
Compare
paul-nechifor
previously approved these changes
Mar 17, 2026
leshy
previously approved these changes
Mar 19, 2026
Conflicts resolved: - global_config.py: keep PR's refactored imports (VlModelName from types, NavigationStrategy from occupancy/types) - path_map.py: take dev's expanded imports (GradientStrategy, gradient, voronoi_gradient) needed by the function
build_file_index now skips paths rooted in .venv, node_modules, __pycache__, or .git. Fixes test_excludes_venv failure when .venv is a symlink (not matched by gitignore trailing-slash patterns).
88b1ed4 to
61f8588
Compare
…le index" This reverts commit 61f8588.
paul-nechifor
approved these changes
Mar 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
dimos --helptakes ~5s becauseGlobalConfigimportsNavigationStrategyfrompath_map.py(which pulls in matplotlib/scipy/numpy) andVlModelNamefromcreate.py(which pulls in torch/langchain). These are justLiteraltype aliases but they drag in the entire ML stack.Solution
Move the type aliases into lightweight files in their respective packages:
dimos/mapping/occupancy/types.py→NavigationStrategydimos/models/vl/types.py→VlModelNameglobal_config.pyimports from these instead. Original modules re-export so existing imports still work.Also adds a regression test that fails if
dimos --helptakes >8s or if heavy deps leak into the CLI entrypoint.Breaking Changes
None. All existing imports of
NavigationStrategyandVlModelNamestill work.How to Test
Contributor License Agreement