Skip to main content

Installer

Struct Installer 

Source
pub struct Installer {
    pub config: InstallConfig,
    /* private fields */
}
Expand description

Stateful installation context. The located uv/micromamba/Conda executables and selected Torch backend are cached across recipes in one run.

Fields§

§config: InstallConfig

Implementations§

Source§

impl Installer

Source

pub fn new(root: impl Into<PathBuf>) -> Self

Source

pub fn from_environment(root: impl Into<PathBuf>) -> Result<Self, InstallError>

Construct an installer using the compatibility environment variables documented by the original Molchanica and bio_web installers.

Source

pub fn for_process_executables( root: impl Into<PathBuf>, ) -> Result<Self, InstallError>

Construct an installer for the shared process_executables/python_envs layout.

Examples found in repository?
examples/readme_install.rs (line 4)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4    let mut installer = Installer::for_process_executables("process_executables")?;
5    installer.install(Tool::OpenDde)?;
6
7    // Independent recipes continue after an upstream failure.
8    let report = installer.install_many([Tool::Boltz2, Tool::ProteinMpnn]);
9    for failure in &report.failed {
10        eprintln!("{}: {}", failure.tool.name(), failure.error);
11    }
12
13    // Status: `status_quick` inspects markers, executables, and required assets
14    // without launching the tool; `status_full` also runs its help/version probe.
15    let status = installer.status_quick(Tool::OpenDde);
16    println!("{:?}: {}", status.result, status.detail);
17
18    let report = installer.uninstall(Tool::OpenDde)?;
19    println!("Removed {} paths", report.removed.len());
20    Ok(())
21}
Source

pub fn from_config(config: InstallConfig) -> Self

Source

pub fn with_reporter( self, reporter: impl Fn(InstallEvent) + Send + Sync + 'static, ) -> Self

Source

pub fn environment_path(&self, tool: Tool) -> PathBuf

Source

pub fn executable_path(&self, tool: Tool) -> PathBuf

Locate a tool’s installed console entry point in its managed environment.

Source

pub fn tool_command(&self, tool: Tool) -> CommandSpec

Build a command for a tool’s console entry point in its managed environment.

The child receives VIRTUAL_ENV and a PATH whose first directory is the tool environment’s scripts directory. This is equivalent to activating the environment before running its console script, and lets dependencies such as PyTorch find helper executables installed beside the script.

Source

pub fn tool_python_command(&self, tool: Tool) -> CommandSpec

Build a command for the managed Python interpreter of a tool.

Source

pub fn tools_root(&self) -> &Path

Source

pub fn install(&mut self, tool: Tool) -> Result<(), InstallError>

Install or refresh one tool. Recipes are designed to be safely rerunnable.

Examples found in repository?
examples/readme_install.rs (line 5)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4    let mut installer = Installer::for_process_executables("process_executables")?;
5    installer.install(Tool::OpenDde)?;
6
7    // Independent recipes continue after an upstream failure.
8    let report = installer.install_many([Tool::Boltz2, Tool::ProteinMpnn]);
9    for failure in &report.failed {
10        eprintln!("{}: {}", failure.tool.name(), failure.error);
11    }
12
13    // Status: `status_quick` inspects markers, executables, and required assets
14    // without launching the tool; `status_full` also runs its help/version probe.
15    let status = installer.status_quick(Tool::OpenDde);
16    println!("{:?}: {}", status.result, status.detail);
17
18    let report = installer.uninstall(Tool::OpenDde)?;
19    println!("Removed {} paths", report.removed.len());
20    Ok(())
21}
Source

pub fn status_quick(&self, tool: Tool) -> ToolStatus

Inspect an installed tool without launching its application code.

Examples found in repository?
examples/readme_install.rs (line 15)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4    let mut installer = Installer::for_process_executables("process_executables")?;
5    installer.install(Tool::OpenDde)?;
6
7    // Independent recipes continue after an upstream failure.
8    let report = installer.install_many([Tool::Boltz2, Tool::ProteinMpnn]);
9    for failure in &report.failed {
10        eprintln!("{}: {}", failure.tool.name(), failure.error);
11    }
12
13    // Status: `status_quick` inspects markers, executables, and required assets
14    // without launching the tool; `status_full` also runs its help/version probe.
15    let status = installer.status_quick(Tool::OpenDde);
16    println!("{:?}: {}", status.result, status.detail);
17
18    let report = installer.uninstall(Tool::OpenDde)?;
19    println!("Removed {} paths", report.removed.len());
20    Ok(())
21}
Source

pub fn status_full(&self, tool: Tool) -> ToolStatus

Launch an installed tool’s status probe and inspect its compute device.

Source

pub fn status(&self, tool: Tool) -> ToolStatus

Backwards-compatible alias for Installer::status_full.

Source

pub fn list_quick(&self) -> Vec<(Tool, ToolStatus)>

Quickly inspect every tool installed by this crate.

Source

pub fn list_full(&self) -> Vec<(Tool, ToolStatus)>

Fully probe every tool installed by this crate.

Source

pub fn list(&self) -> Vec<(Tool, ToolStatus)>

Backwards-compatible alias for Installer::list_full.

Source

pub fn uninstall(&mut self, tool: Tool) -> Result<UninstallReport, InstallError>

Remove one tool’s environment, assets, and installation marker.

Rerunnable in the same sense the recipes are: a tool that is already absent uninstalls successfully with an empty report, which is what makes this safe to offer as a button beside a status that may be a few minutes stale.

Examples found in repository?
examples/readme_install.rs (line 18)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4    let mut installer = Installer::for_process_executables("process_executables")?;
5    installer.install(Tool::OpenDde)?;
6
7    // Independent recipes continue after an upstream failure.
8    let report = installer.install_many([Tool::Boltz2, Tool::ProteinMpnn]);
9    for failure in &report.failed {
10        eprintln!("{}: {}", failure.tool.name(), failure.error);
11    }
12
13    // Status: `status_quick` inspects markers, executables, and required assets
14    // without launching the tool; `status_full` also runs its help/version probe.
15    let status = installer.status_quick(Tool::OpenDde);
16    println!("{:?}: {}", status.result, status.detail);
17
18    let report = installer.uninstall(Tool::OpenDde)?;
19    println!("Removed {} paths", report.removed.len());
20    Ok(())
21}
Source

pub fn install_many( &mut self, tools: impl IntoIterator<Item = Tool>, ) -> InstallReport

Install several tools without letting one broken upstream release suppress the rest.

Examples found in repository?
examples/readme_install.rs (line 8)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4    let mut installer = Installer::for_process_executables("process_executables")?;
5    installer.install(Tool::OpenDde)?;
6
7    // Independent recipes continue after an upstream failure.
8    let report = installer.install_many([Tool::Boltz2, Tool::ProteinMpnn]);
9    for failure in &report.failed {
10        eprintln!("{}: {}", failure.tool.name(), failure.error);
11    }
12
13    // Status: `status_quick` inspects markers, executables, and required assets
14    // without launching the tool; `status_full` also runs its help/version probe.
15    let status = installer.status_quick(Tool::OpenDde);
16    println!("{:?}: {}", status.result, status.detail);
17
18    let report = installer.uninstall(Tool::OpenDde)?;
19    println!("Removed {} paths", report.removed.len());
20    Ok(())
21}

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.