Skip to content

Comments

Support uv run -m foo to run a module#7322

Closed
j178 wants to merge 2 commits intoastral-sh:mainfrom
j178:run-module
Closed

Support uv run -m foo to run a module#7322
j178 wants to merge 2 commits intoastral-sh:mainfrom
j178:run-module

Conversation

@j178
Copy link
Contributor

@j178 j178 commented Sep 12, 2024

Summary

Resolves #6638

@j178 j178 marked this pull request as draft September 12, 2024 05:14
@j178
Copy link
Contributor Author

j178 commented Sep 12, 2024

I'm having trouble with the command uv run -m venv -h; the -h option is being interpreted by the global arguments of uv instead of being passed down to venv.

@zanieb
Copy link
Member

zanieb commented Sep 12, 2024

Ah that's tough. I'm not sure if we can support passing arguments to modules in that way?

@zanieb
Copy link
Member

zanieb commented Sep 12, 2024

It seems like an argument against this interface since it's a bit ambiguous. I wonder if Clap even supports parsing the rest as a command?

@eth3lbert
Copy link
Contributor

The simplest solution I could think of would be to make -m an Option<bool> (or bool with default_value?) flag with num_args=0 and an action that sets it to true. Then, we could simply leverage the command as external subcommand (args in this case) as before. However, I'm unsure how to guarantee that the command is followed by the -m flag exactly.

kazuki0824 added a commit to kazuki0824/uv-cibuildwheel-ruff-coverage-template that referenced this pull request Sep 22, 2024
kazuki0824 added a commit to kazuki0824/uv-cibuildwheel-ruff-coverage-template that referenced this pull request Sep 22, 2024
kazuki0824 added a commit to kazuki0824/uv-cibuildwheel-ruff-coverage-template that referenced this pull request Sep 22, 2024
kazuki0824 added a commit to kazuki0824/uv-cibuildwheel-ruff-coverage-template that referenced this pull request Sep 22, 2024
kazuki0824 added a commit to kazuki0824/uv-cibuildwheel-ruff-coverage-template that referenced this pull request Sep 22, 2024
@j178 j178 closed this Sep 25, 2024
zanieb pushed a commit that referenced this pull request Sep 28, 2024
## Summary

This is another attempt using `module: bool` instead of `module:
Option<String>` following #7322.
The original PR can't be reopened after a force-push to the branch, I've
created this new PR.

Resolves #6638
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.

How to run a library module?

3 participants