Skip to content

Conversation

@SeungjinYang
Copy link
Collaborator

import sky statement in internal code imports a lot of (unnecessary) things at once, causing unnecessary circular import issues and overall making the codepath slower. Reduce the occurrence of import sky statements by importing more targeted modules whenever possible.

Tested (run the relevant ones):

  • Code formatting: install pre-commit (auto-check on commit) or bash format.sh
  • Any manual or new tests for this PR (please specify below)
  • All smoke tests: /smoke-test (CI) or pytest tests/test_smoke.py (local)
  • Relevant individual tests: /smoke-test -k test_name (CI) or pytest tests/test_smoke.py::test_name (local)
  • Backward compatibility: /quicktest-core (CI) or pytest tests/smoke_tests/test_backward_compat.py (local)

@SeungjinYang SeungjinYang marked this pull request as ready for review August 13, 2025 04:05
@Michaelvll
Copy link
Collaborator

Michaelvll commented Aug 13, 2025

Thanks @SeungjinYang! Do we know much performance improvement for importing sky?

@SeungjinYang
Copy link
Collaborator Author

Sadly there is actually zero perf improvement for avoiding sky import, because importing modules like backend, task, and dag which live in the /sky folder triggers execute of __init__.py. This will become useful once these modules are moved away from package root, at which point we will see improvement.

@SeungjinYang
Copy link
Collaborator Author

/quicktest-core

@SeungjinYang
Copy link
Collaborator Author

/smoke-test

@SeungjinYang SeungjinYang merged commit c24ef5a into master Aug 13, 2025
18 checks passed
@SeungjinYang SeungjinYang deleted the reduce-import-sky branch August 13, 2025 06:16
massaindustries pushed a commit to Seeweb/skypilot that referenced this pull request Aug 26, 2025
* init

* additional

* task_lib

* registries

* more fixes

* undo admin policy

* testfix attempt

* textfix2

* remove import sky even in typechecking
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.

3 participants