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

Add --refresh to uv venv #10834

Merged
merged 1 commit into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions crates/uv-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2472,6 +2472,9 @@ pub struct VenvArgs {
#[arg(long, value_enum, env = EnvVars::UV_LINK_MODE)]
pub link_mode: Option<uv_install_wheel::linker::LinkMode>,

#[command(flatten)]
pub refresh: RefreshArgs,

#[command(flatten)]
pub compat_args: compat::VenvCompatArgs,
}
Expand Down
6 changes: 5 additions & 1 deletion crates/uv/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,11 @@ async fn run(mut cli: Cli) -> Result<ExitStatus> {
show_settings!(args);

// Initialize the cache.
let cache = cache.init()?;
let cache = cache.init()?.with_refresh(
args.refresh
.combine(Refresh::from(args.settings.reinstall.clone()))
.combine(Refresh::from(args.settings.upgrade.clone())),
);

// Since we use ".venv" as the default name, we use "." as the default prompt.
let prompt = args.prompt.or_else(|| {
Expand Down
3 changes: 3 additions & 0 deletions crates/uv/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2206,6 +2206,7 @@ pub(crate) struct VenvSettings {
pub(crate) system_site_packages: bool,
pub(crate) relocatable: bool,
pub(crate) no_project: bool,
pub(crate) refresh: Refresh,
pub(crate) settings: PipSettings,
}

Expand All @@ -2228,6 +2229,7 @@ impl VenvSettings {
exclude_newer,
no_project,
link_mode,
refresh,
compat_args: _,
} = args;

Expand All @@ -2239,6 +2241,7 @@ impl VenvSettings {
system_site_packages,
no_project,
relocatable,
refresh: Refresh::from(refresh),
settings: PipSettings::combine(
PipOptions {
python: python.and_then(Maybe::into_option),
Expand Down
4 changes: 4 additions & 0 deletions docs/reference/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -8084,6 +8084,10 @@ uv venv [OPTIONS] [PATH]
</ul>
</dd><dt><code>--quiet</code>, <code>-q</code></dt><dd><p>Do not print any output</p>

</dd><dt><code>--refresh</code></dt><dd><p>Refresh all cached data</p>

</dd><dt><code>--refresh-package</code> <i>refresh-package</i></dt><dd><p>Refresh cached data for a specific package</p>

</dd><dt><code>--relocatable</code></dt><dd><p>Make the virtual environment relocatable.</p>

<p>A relocatable virtual environment can be moved around and redistributed without invalidating its associated entrypoint and activation scripts.</p>
Expand Down
Loading