mirror of https://github.com/astral-sh/uv
feat: allow setting installer name other than `uv` (#2561)
## Summary We would like to be able to configure the installer-name so that other tools can co-exist with `uv`. In `pixi` we would like to use `pixi-uv` as the installer name, for example, to be able to distinguish them from packages installed by pure `uv`.
This commit is contained in:
parent
00fc44012c
commit
1255c981a7
|
|
@ -9,6 +9,7 @@ pub struct Installer<'a> {
|
|||
venv: &'a PythonEnvironment,
|
||||
link_mode: install_wheel_rs::linker::LinkMode,
|
||||
reporter: Option<Box<dyn Reporter>>,
|
||||
installer_name: Option<String>,
|
||||
}
|
||||
|
||||
impl<'a> Installer<'a> {
|
||||
|
|
@ -18,6 +19,7 @@ impl<'a> Installer<'a> {
|
|||
venv,
|
||||
link_mode: install_wheel_rs::linker::LinkMode::default(),
|
||||
reporter: None,
|
||||
installer_name: Some("uv".to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -36,6 +38,15 @@ impl<'a> Installer<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Set the `installer_name` to something other than `"uv"`.
|
||||
#[must_use]
|
||||
pub fn with_installer_name(self, installer_name: Option<String>) -> Self {
|
||||
Self {
|
||||
installer_name,
|
||||
..self
|
||||
}
|
||||
}
|
||||
|
||||
/// Install a set of wheels into a Python virtual environment.
|
||||
#[instrument(skip_all, fields(num_wheels = %wheels.len()))]
|
||||
pub fn install(self, wheels: &[CachedDist]) -> Result<()> {
|
||||
|
|
@ -52,7 +63,7 @@ impl<'a> Installer<'a> {
|
|||
.map(pypi_types::DirectUrl::try_from)
|
||||
.transpose()?
|
||||
.as_ref(),
|
||||
Some("uv"),
|
||||
self.installer_name.as_deref(),
|
||||
self.link_mode,
|
||||
)
|
||||
.with_context(|| format!("Failed to install: {} ({wheel})", wheel.filename()))?;
|
||||
|
|
|
|||
Loading…
Reference in New Issue