Repository: skypilot-org/skypilot
Pull request: [Setup] Remove the dependency for typing_extensions
<!-- Describe the changes in this PR -->

Fixes #1631

<!-- Describe the tests ran -->
<!-- Unit tests (tests/test_*.py) are part of GitHub CI; below are tests that launch on the cloud. -->

Tested (run the relevant ones):

- [x] `pip install .`

Problem statement:
ModuleNotFoundError: No module named 'typing_extensions'
Good morning sky team,

An `ModuleNotFoundError` after update skypilot yesterday.

```{shell}
$ sky status -r
Traceback (most recent call last):
  File "/Users/hanqingliu/mambaforge/bin/sky", line 5, in <module>
    from sky.cli import cli
  File "/Users/hanqingliu/mambaforge/lib/python3.9/site-packages/sky/__init__.py", line 10, in <module>
    from sky import backends
  File "/Users/hanqingliu/mambaforge/lib/python3.9/site-packages/sky/backends/__init__.py", line 3, in <module>
    from sky.backends.cloud_vm_ray_backend import CloudVmRayBackend
  File "/Users/hanqingliu/mambaforge/lib/python3.9/site-packages/sky/backends/cloud_vm_ray_backend.py", line 27, in <module>
    from sky import cloud_stores
  File "/Users/hanqingliu/mambaforge/lib/python3.9/site-packages/sky/cloud_stores.py", line 14, in <module>
    from sky.data import data_utils
  File "/Users/hanqingliu/mambaforge/lib/python3.9/site-packages/sky/data/__init__.py", line 2, in <module>
    from sky.data.storage import Storage, StorageMode, StoreType
  File "/Users/hanqingliu/mambaforge/lib/python3.9/site-packages/sky/data/storage.py", line 8, in <module>
    from typing_extensions import TypeAlias
ModuleNotFoundError: No module named 'typing_extensions'
```

Hints from issue discussion:
Thank you for finding this! Could you try to run `pip install typing-extensions` to install that dependency?

Commit message: Add type-extensions to setup.py

Patch to review:
diff --git a/sky/setup_files/setup.py b/sky/setup_files/setup.py
index 4857f0e82fe..26b43d47950 100644
--- a/sky/setup_files/setup.py
+++ b/sky/setup_files/setup.py
@@ -83,6 +83,7 @@ def parse_readme(readme: str) -> str:
     'ray[default]>=1.9.0,<=2.2.0',
     'rich',
     'tabulate',
+    'typing-extensions',
     'filelock',  # TODO(mraheja): Enforce >=3.6.0 when python version is >= 3.7
     # This is used by ray. The latest 1.44.0 will generate an error
     # `Fork support is only compatible with the epoll1 and poll


Code review comments:
diff_hunk: @@ -83,6 +83,7 @@ def parse_readme(readme: str) -> str:
     'ray[default]>=1.9.0,<=2.2.0',
     'rich',
     'tabulate',
+    'typing-extensions',
path: sky/setup_files/setup.py
text: @user1:
Can we remove our dependency? Like L31 and L32 in storage.py, can we change L33 and L34 to:
Before
```
StorageHandle = Any
StorageStatus = global_user_state.StorageStatus
Path: TypeAlias = str
SourceType: TypeAlias = Union[Path, List[Path]]
```

After
```
StorageHandle = Any
StorageStatus = global_user_state.StorageStatus
Path = str
SourceType = Union[Path, List[Path]]
```

@user1:
mypy (format.py) appears to pass with this change

@author:
Ahh, great catch! Removed the dependency. Thanks!