From 29aca32618ab4eadacbae0504fef28798034523c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ak=E1=B9=A3aya=20=C5=9Ar=C4=ABniv=C4=81san?= Date: Wed, 13 May 2026 13:42:44 +0530 Subject: [PATCH 1/2] skypilot: fix for incompat. w/ defaults handling in click >= 8.2 --- ...-default-for-Click-8.2-compatibility.patch | 31 +++++++++++++++++++ pkgs/by-name/sk/skypilot/package.nix | 4 +++ 2 files changed, 35 insertions(+) create mode 100644 pkgs/by-name/sk/skypilot/0001-Fix-docker-flag-default-for-Click-8.2-compatibility.patch diff --git a/pkgs/by-name/sk/skypilot/0001-Fix-docker-flag-default-for-Click-8.2-compatibility.patch b/pkgs/by-name/sk/skypilot/0001-Fix-docker-flag-default-for-Click-8.2-compatibility.patch new file mode 100644 index 000000000000..4192588ac4a5 --- /dev/null +++ b/pkgs/by-name/sk/skypilot/0001-Fix-docker-flag-default-for-Click-8.2-compatibility.patch @@ -0,0 +1,31 @@ +From 6a2202baf3edff90aea6b66996a8e11e4e7c133e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ak=E1=B9=A3aya=20=C5=9Ar=C4=ABniv=C4=81san?= + +Date: Wed, 13 May 2026 13:31:19 +0530 +Subject: [PATCH] Fix --docker flag default for Click >= 8.2 compatibility + +Click 8.2 changed flag_value option handling: default=False is no longer +normalised to None before the 'is None' guard. Change to default=None so +sky launch works with Click >= 8.2 (e.g. nixpkgs). + +Upstream constrains click<8.2; this makes the code robust to newer versions. +--- + sky/client/cli/command.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sky/client/cli/command.py b/sky/client/cli/command.py +index 6ee1102d0..15a5057d6 100644 +--- a/sky/client/cli/command.py ++++ b/sky/client/cli/command.py +@@ -1072,7 +1072,7 @@ def _handle_infra_cloud_region_zone_options(infra: Optional[str], + @click.option('--docker', + 'backend_name', + flag_value=backends.LocalDockerBackend.NAME, +- default=False, ++ default=None, + hidden=True, + help=('(Deprecated) Local docker support is deprecated. ' + 'To run locally, create a local Kubernetes cluster with ' +-- +2.53.0 + diff --git a/pkgs/by-name/sk/skypilot/package.nix b/pkgs/by-name/sk/skypilot/package.nix index d48db1649d1a..44b19af0f7c9 100644 --- a/pkgs/by-name/sk/skypilot/package.nix +++ b/pkgs/by-name/sk/skypilot/package.nix @@ -35,6 +35,10 @@ python3Packages.buildPythonApplication (finalAttrs: { pyproject = true; pythonRelaxDeps = true; + patches = [ + ./0001-Fix-docker-flag-default-for-Click-8.2-compatibility.patch + ]; + nativeBuildInputs = [ writableTmpDirAsHomeHook ]; From 75e8b52ec6fee74df6fe59c9d342c062c260ef89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ak=E1=B9=A3aya=20=C5=9Ar=C4=ABniv=C4=81san?= Date: Sun, 31 May 2026 14:53:26 +0530 Subject: [PATCH 2/2] skypilot: wrap websocket_proxy.py with wrapPythonProgramsIn --- ...y-call-script-directly-as-executable.patch | 37 +++++++++++++++++++ pkgs/by-name/sk/skypilot/package.nix | 6 +++ 2 files changed, 43 insertions(+) create mode 100644 pkgs/by-name/sk/skypilot/0002-Fix-websocket-proxy-call-script-directly-as-executable.patch diff --git a/pkgs/by-name/sk/skypilot/0002-Fix-websocket-proxy-call-script-directly-as-executable.patch b/pkgs/by-name/sk/skypilot/0002-Fix-websocket-proxy-call-script-directly-as-executable.patch new file mode 100644 index 000000000000..781741b2dc37 --- /dev/null +++ b/pkgs/by-name/sk/skypilot/0002-Fix-websocket-proxy-call-script-directly-as-executable.patch @@ -0,0 +1,37 @@ +diff --git a/sky/client/cli/command.py b/sky/client/cli/command.py +index 15a5057d6..5417cad9f 100644 +--- a/sky/client/cli/command.py ++++ b/sky/client/cli/command.py +@@ -203,7 +203,6 @@ def _get_cluster_records_and_set_ssh_config( + escaped_key_path = shlex.quote( + (cluster_utils.SSHConfigHelper.generate_local_key_file( + handle.cluster_name, credentials))) +- escaped_executable_path = shlex.quote(sys.executable) + escaped_websocket_proxy_path = shlex.quote( + f'{directory_utils.get_sky_dir()}/templates/websocket_proxy.py') + # Instead of directly use websocket_proxy.py, we add an +@@ -220,8 +219,7 @@ def _get_cluster_records_and_set_ssh_config( + # TODO(zhwu): write the template to a temp file, don't use + # the one in skypilot repo, to avoid changing the file when + # updating skypilot. +- f'\"{escaped_executable_path} ' +- f'{escaped_websocket_proxy_path} ' ++ f'\"{escaped_websocket_proxy_path} ' + f'{server_common.get_server_url()} ' + f'{handle.cluster_name} ' + f'kubernetes-pod-ssh-proxy\"') +@@ -229,13 +227,11 @@ def _get_cluster_records_and_set_ssh_config( + elif isinstance(handle.launched_resources.cloud, clouds.Slurm): + # Replace the proxy command to proxy through the SkyPilot API + # server with websocket. +- escaped_executable_path = shlex.quote(sys.executable) + escaped_websocket_proxy_path = shlex.quote( + f'{directory_utils.get_sky_dir()}/templates/websocket_proxy.py') + # %w is a placeholder for the node index, substituted per-node + # in cluster_utils.SSHConfigHelper.add_cluster(). +- proxy_command = (f'{escaped_executable_path} ' +- f'{escaped_websocket_proxy_path} ' ++ proxy_command = (f'{escaped_websocket_proxy_path} ' + f'{server_common.get_server_url()} ' + f'{handle.cluster_name} ' + f'slurm-job-ssh-proxy %w') diff --git a/pkgs/by-name/sk/skypilot/package.nix b/pkgs/by-name/sk/skypilot/package.nix index 44b19af0f7c9..fe2dfc14dbe9 100644 --- a/pkgs/by-name/sk/skypilot/package.nix +++ b/pkgs/by-name/sk/skypilot/package.nix @@ -37,6 +37,7 @@ python3Packages.buildPythonApplication (finalAttrs: { patches = [ ./0001-Fix-docker-flag-default-for-Click-8.2-compatibility.patch + ./0002-Fix-websocket-proxy-call-script-directly-as-executable.patch ]; nativeBuildInputs = [ @@ -221,6 +222,11 @@ python3Packages.buildPythonApplication (finalAttrs: { cp -r ${dashboard}/* $out/${python3Packages.python.sitePackages}/sky/dashboard/out/ ''; + postFixup = '' + chmod +x $out/${python3Packages.python.sitePackages}/sky/templates/websocket_proxy.py + wrapPythonProgramsIn "$out/${python3Packages.python.sitePackages}/sky/templates" "$out ''${pythonPath[*]}" + ''; + # Excluding the tests as it fails with error: # Message: 'Config loaded from /build/source/examples/admin_policy/restful_policy.yaml:\nadmin_policy: http://localhost:8080\n' #Arguments: ()