-
Notifications
You must be signed in to change notification settings - Fork 785
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
Add --gui-script flag for running Python scripts with pythonw.exe on … #9152
base: main
Are you sure you want to change the base?
Conversation
e6ca059
to
4740ff3
Compare
You can add an ignore for that Clippy complaint, if you want — or we will. We generally take our time about splitting those bools out into a struct. |
crates/uv/tests/it/run.rs
Outdated
sys.exit(1) | ||
"#})?; | ||
|
||
let output = context.run().arg("--script").arg("script").output()?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be using --gui-script
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, but would this pass with exit code 0 on a headless windows CI run?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are right, and I'm slightly confused why/how we passed tests with that typo... Changing now and will see how it behaves!
Nice! I made some minor tweaks and have one blocking question. |
Perfect thank you! |
removed attempt to detect GUI console & just check execution engine instead
Addresses #6805
Summary
This PR adds a
--gui-script
flag touv run
that allows running Python scripts withpythonw.exe
on Windows, regardless of file extension. This solves the issue where users need to maintain duplicate.py
and.pyw
files to run the same script with and without a console window.The implementation follows the pattern established by the existing
--script
flag, but usespythonw.exe
instead ofpython.exe
on Windows. On non-Windows platforms, the flag is present but returns an error indicating it's Windows-only functionality.Changes:
--gui-script
flag (Windows-only)Test Plan
The changes are tested through:
New Windows-specific test that verifies:
pythonw.exe
when using--gui-script
New non-Windows test that verifies:
--gui-script
is used on non-Windows platformsDocumentation updates to clearly indicate Windows-only functionality