mirror of https://github.com/astral-sh/uv
Add `--refresh` to `uv venv` (#10834)
## Summary I was surprised that this didn't exist.
This commit is contained in:
parent
d952a97f1c
commit
a7166fff8a
|
|
@ -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,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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(|| {
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
}
|
||||
|
||||
|
|
@ -2228,6 +2229,7 @@ impl VenvSettings {
|
|||
exclude_newer,
|
||||
no_project,
|
||||
link_mode,
|
||||
refresh,
|
||||
compat_args: _,
|
||||
} = args;
|
||||
|
||||
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Reference in New Issue