fix(gateway): use _resolve_detached_python for uv venvs in .cmd generation - #30314
Closed
OLDBAI213 wants to merge 1 commit into
Closed
fix(gateway): use _resolve_detached_python for uv venvs in .cmd generation#30314OLDBAI213 wants to merge 1 commit into
OLDBAI213 wants to merge 1 commit into
Conversation
Collaborator
Author
|
Hi! Following up on this PR. Let me know if any changes are needed. Thanks! |
Contributor
|
Thanks for documenting the uv launcher diagnosis. This is now implemented on
This PR itself changes only |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #30308 —
hermes gateway startpops up cmd.exe console window on Windows with uv-managed venvs.Root Cause
In
hermes_cli/gateway_windows.py, the function_build_gateway_cmd_script()uses_derive_venv_pythonw(python_path)to find the windowless python interpreter. This function only looks for a siblingpythonw.exein the venv'sScripts/directory.For uv-managed venvs,
venv/Scripts/pythonw.exeis a uv-generated shim (~44KB) that spawnspython.exe(with console), not the realpythonw.exe.Fix
Replace
_derive_venv_pythonw(python_path)with_resolve_detached_python(python_path)in_build_gateway_cmd_script(). This function already exists in the same file and correctly handles uv detection.When uv is detected, add
PYTHONPATHto the generated.cmdso the base interpreter can find venv site-packages.Change in
_build_gateway_cmd_script():Why This Works
_resolve_detached_python()already:pyvenv.cfgto detect uv-managed venvspythonw.exe(not the shim)PYTHONPATHentries for importsThis is the same function used by
_build_gateway_argv()and_spawn_detached(). The.cmdgeneration was the only path that didn't use it.Testing
.cmdnow uses realpythonw.exehermes gateway startNotes
_build_gateway_cmd_script()changesFIX_DESCRIPTION.mdfor detailed diff