Skip to content

Commit f02f0f6

Browse files
authored
Fix the version parsing with third-party tool (skypilot-org#1049)
* version parsing * format * format * update setup * address comments
1 parent bccc512 commit f02f0f6

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

sky/backends/backend_utils.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import filelock
2222
import jinja2
2323
import jsonschema
24+
from packaging import version
2425
import psutil
2526
import requests
2627
from requests import adapters
@@ -628,7 +629,7 @@ def write_cluster_config(to_provision: 'resources.Resources',
628629
# Sky remote utils.
629630
'sky_remote_path': SKY_REMOTE_PATH,
630631
'sky_local_path': str(local_wheel_path),
631-
'sky_version': common_utils.normalize_version(sky.__version__),
632+
'sky_version': str(version.parse(sky.__version__)),
632633
# Local IP handling (optional).
633634
'head_ip': None if ip_list is None else ip_list[0],
634635
'worker_ips': None if ip_list is None else ip_list[1:],

sky/backends/wheel_utils.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
from typing import Optional
99

1010
import filelock
11+
from packaging import version
1112

1213
import sky
1314
from sky.backends import backend_utils
14-
from sky.utils import common_utils
1515

1616
# Local wheel path is same as the remote path.
1717
WHEEL_DIR = pathlib.Path(os.path.expanduser(backend_utils.SKY_REMOTE_PATH))
@@ -37,13 +37,14 @@ def cleanup_wheels_dir(wheel_dir: pathlib.Path,
3737

3838

3939
def _get_latest_built_wheel() -> pathlib.Path:
40+
wheel_name = (f'{_PACKAGE_WHEEL_NAME}-'
41+
f'{version.parse(sky.__version__)}-*.whl')
4042
try:
41-
latest_wheel = max(WHEEL_DIR.glob(
42-
f'{_PACKAGE_WHEEL_NAME}-'
43-
f'{common_utils.normalize_version(sky.__version__)}-*.whl'),
44-
key=os.path.getctime)
43+
latest_wheel = max(WHEEL_DIR.glob(wheel_name), key=os.path.getctime)
4544
except ValueError:
46-
raise FileNotFoundError('Could not find built Sky wheels.') from None
45+
raise FileNotFoundError(
46+
f'Could not find built SkyPilot wheels {wheel_name!r} '
47+
f'under {WHEEL_DIR!r}') from None
4748
return latest_wheel
4849

4950

sky/setup_files/setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ def parse_footnote(readme: str) -> str:
7474
# `Fork support is only compatible with the epoll1 and poll
7575
# polling strategies`
7676
'grpcio<=1.43.0',
77+
'packaging',
7778
# The latest 4.21.1 will break ray. Enforce < 4.0.0 until Ray releases the
7879
# fix.
7980
# https://github.com/ray-project/ray/pull/25211

sky/utils/common_utils.py

-5
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,3 @@ def method_with_retries(*args, **kwargs):
183183
raise
184184

185185
return method_with_retries
186-
187-
188-
def normalize_version(version: str) -> str:
189-
"""Normalize a version string."""
190-
return version.replace('-dev', '.dev')

0 commit comments

Comments
 (0)