Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report the queried executable path in uv python list #12628

Merged
merged 1 commit into from
Apr 2, 2025
Merged

Conversation

zanieb
Copy link
Member

@zanieb zanieb commented Apr 2, 2025

In an attempt to avoid reporting shims as their resolved sys.executable path, we report the queried executable path instead. This seems more correct for this command, broadly? Interestingly, it changes the reported paths for Homebrew Python

Screenshot 2025-04-02 at 11 05 18 AM

Closes #9979

@zanieb zanieb added the cli Related to the command line interface label Apr 2, 2025
@zanieb zanieb requested a review from Gankra April 2, 2025 16:08
@zanieb
Copy link
Member Author

zanieb commented Apr 2, 2025

I can try to add some test coverage here, but it seems kind of tricky.

@zanieb
Copy link
Member Author

zanieb commented Apr 2, 2025

@Gankra would you try this out on your bespoke Windows setup?

@Gankra
Copy link
Contributor

Gankra commented Apr 2, 2025

Confirmed this is working the way you want:

cpython-3.13.2-windows-x86_64-none                   C:\ProgramData\chocolatey\bin\python3.13.exe
cpython-3.13.2-windows-x86_64-none                   C:\Users\gankra\AppData\Roaming\uv\python\cpython-3.13.2-windows-x86_64-none\python.exe
cpython-3.12.9-windows-x86_64-none                   <download available>
cpython-3.11.11-windows-x86_64-none                  C:\Users\gankra\AppData\Roaming\uv\python\cpython-3.11.11-windows-x86_64-none\python.exe

@zanieb zanieb marked this pull request as ready for review April 2, 2025 17:52
@Gankra
Copy link
Contributor

Gankra commented Apr 2, 2025

Hmm wait does this change whether we actually invoke the shim? The "bug" was purely display?

@zanieb
Copy link
Member Author

zanieb commented Apr 2, 2025

Can you say more? Interpreter discovery invokes each executable it finds. Previously, we reported sys.executable (which for a shim, is the resolved path) — now, we report the invoked executable (i.e., the path we discovered).

@zanieb zanieb added the enhancement New feature or improvement to existing functionality label Apr 2, 2025
@zanieb zanieb merged commit 12e63eb into main Apr 2, 2025
76 checks passed
@zanieb zanieb deleted the zb/shim-fix branch April 2, 2025 19:25
@Gankra
Copy link
Contributor

Gankra commented Apr 2, 2025

The detail I was unclear on was whether we kept invoking through that executable once we found it, or if we cached the sys.executable path and used that directly.

@zanieb
Copy link
Member Author

zanieb commented Apr 2, 2025

Well.. we keep invoking through sys.executable in general, because we never tracked the original path. In uv python list, we don't invoke the interpreter again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Related to the command line interface enhancement New feature or improvement to existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Python listed twice on Windows
2 participants