Skip to content

Instantly share code, notes, and snippets.

@huksley
Created January 14, 2026 11:08
Show Gist options
  • Select an option

  • Save huksley/aa5bf9420ab101e96294877fc8bcf4f9 to your computer and use it in GitHub Desktop.

Select an option

Save huksley/aa5bf9420ab101e96294877fc8bcf4f9 to your computer and use it in GitHub Desktop.
Disable LazyImport magic
diff --git a/sky/adaptors/common.py b/sky/adaptors/common.py
index 38c24ad4f..ceffb1fd3 100644
--- a/sky/adaptors/common.py
+++ b/sky/adaptors/common.py
@@ -59,18 +59,6 @@ class LazyImport(types.ModuleType):
except AttributeError:
# Dynamically create a new LazyImport instance for the submodule
submodule_name = f'{self._module_name}.{name}'
- try:
- # Check if the submodule exists
- if importlib_util.find_spec(submodule_name) is None:
- raise AttributeError( # pylint: disable=raise-missing-from
- f'Module {self._module_name} has no attribute {name}')
- except (ValueError, ImportError):
- # find_spec raises ValueError if the name is invalid
- # (e.g. contains dots) or ImportError
- raise AttributeError(
- f'Module {self._module_name} has no attribute {name}'
- ) from None
-
lazy_submodule = LazyImport(submodule_name,
self._import_error_message)
setattr(self, name, lazy_submodule)
@huksley
Copy link
Author

huksley commented Jan 14, 2026

With this removed, we get TypeError: 'LazyImport' object is not callable

git clone https://github.com/huksley/skypilot/ sky
cd sky
git checkout feat-verda-cloud

Reverse LazyImport bug fix

curl -o LazyImport.patch https://gist.githubusercontent.com/huksley/aa5bf9420ab101e96294877fc8bcf4f9/raw/b3868efe7bd6a4cda7fa5ebab23406067089c597/LazyImport.patch
patch -p1 < LazyImport.patch

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