Skip to content

lazy load legacy modules#1376

Open
jeff-hykin wants to merge 1 commit intodevfrom
jeff/fix/old
Open

lazy load legacy modules#1376
jeff-hykin wants to merge 1 commit intodevfrom
jeff/fix/old

Conversation

@jeff-hykin
Copy link
Member

Problem

Loading extra modules

Solution

Lazy load

Breaking Changes

None

How to Test

dimos --replay run unitree-go2-basic

Contributor License Agreement

  • I have read and approved the CLA.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 27, 2026

Greptile Summary

This PR converts the unitree_webrtc compatibility module from eager loading to lazy loading. The legacy module aliases are now imported on-demand using __getattr__ instead of being loaded immediately at package import time. The implementation correctly maintains the original behavior by caching imported modules in sys.modules, ensuring that modules are only imported once and that the aliased paths remain available for any code expecting them. This change reduces startup time by deferring imports until they're actually needed.

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • The change is a straightforward refactoring that converts eager module loading to lazy loading using the standard Python __getattr__ pattern. The implementation correctly maintains the original caching behavior, follows existing patterns in the codebase, and only affects a compatibility/legacy module with no breaking changes to the public API.
  • No files require special attention

Important Files Changed

Filename Overview
dimos/robot/unitree_webrtc/init.py Converted eager module loading to lazy loading using __getattr__, maintaining module caching behavior

Last reviewed commit: 43b444c

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

Copy link
Contributor

@leshy leshy left a comment

Choose a reason for hiding this comment

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

as far as i can tell this init.py is not neccessary for anything

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants