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

Allow uv run to execute Python scripts directly #3110

Merged
merged 1 commit into from
Apr 19, 2024
Merged

Conversation

zanieb
Copy link
Member

@zanieb zanieb commented Apr 17, 2024

e.g. uv run foo.py implies python foo.py

Future work includes #3096

@zanieb zanieb added internal A refactor or improvement that is not user-facing cli Related to the command line interface labels Apr 17, 2024
Comment on lines -1350 to +1636
pub(crate) args: Vec<String>,
pub(crate) args: Vec<OsString>,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need this to insert a properly insert a path into the arguments, but this seems generally "more correct".

We'll want to do this for target too.

.map_or(false, |ext| ext.eq_ignore_ascii_case("py"))
&& target_path.exists()
{
args.insert(0, target_path.as_os_str().into());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is vaguely not performant but not meaningful?

@zanieb zanieb marked this pull request as ready for review April 19, 2024 15:05
Base automatically changed from zb/uv-run-python to main April 19, 2024 15:15
@zanieb zanieb enabled auto-merge (squash) April 19, 2024 20:56
e.g. `uv run foo.py` implies `python foo.py`
@zanieb zanieb merged commit 4046b2b into main Apr 19, 2024
38 checks passed
@zanieb zanieb deleted the zb/uv-run-script branch April 19, 2024 21:29
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 internal A refactor or improvement that is not user-facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant