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

Support uv run --script #7739

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

tfsingh
Copy link
Contributor

@tfsingh tfsingh commented Sep 27, 2024

This PR adds support for executing a script with uv run, even when the script does not have a .py extension. Addresses #7396.

///
/// Using `--script` will attempt to parse the path as a PEP 723 script,
/// irrespective of its extension.
#[arg(long)]
Copy link
Contributor Author

@tfsingh tfsingh Sep 27, 2024

Choose a reason for hiding this comment

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

Not sure what the best approach to arg parsing is here — we could explicitly enumerate conflicts (such as --extra and --all-extras), but we don't even warn for these as is when running a script (implicitly) so not sure if it's worth doing. Happy to either way!

{
if *script {
let (target, args) = command.split();
if let Some(target) = target {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was lifted from RunCommand::try_from, I thought it best to not meddle with that API by adding a script parameter

@tfsingh tfsingh marked this pull request as ready for review September 27, 2024 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant