uv/crates/install-wheel-rs
samypr100 2cd63f06dc
feat: more rust in trampoline (#5750)
## Summary

This is an experimental PR to replace more unsafe calls with more rust
while still trying to keep the binary size small enough. These changes
roughly increase the size of the trampolines to about 40kb~. This is a
alternate PR to https://github.com/astral-sh/uv/pull/5751.

The primary changes here include
* Switch to use rust path components for ease of path management
* Leverage `std::process::exit` for process exit and cleanup
* Use `std::io::Error::last_os_error` for IO Errors to remove
`FormatMessage` complexity
* Use `std::env::current_exe` to get the current executable instead of
`GetModuleFileNameA`

## Test Plan

Added one more existing test case to trampoline tests.
Still need to verify dunce::canonicalize is desired or not on
find_python_exe.

---------

Co-authored-by: konstin <konstin@mailbox.org>
2024-08-07 08:19:38 +00:00
..
src feat: more rust in trampoline (#5750) 2024-08-07 08:19:38 +00:00
Cargo.toml Use existing METADATA parser in wheel installer (#5508) 2024-07-27 14:38:16 -04:00
Readme.md Use prettier to format the documentation (#5708) 2024-08-02 08:58:31 -05:00

Reimplementation of wheel installing in rust. Supports both classical venvs and monotrail.

There are simple python bindings:

from install_wheel_rs import LockedVenv

locked_venv = LockedVenv("path/to/.venv")
locked_venv.install_wheel("path/to/some_tagged_wheel.whl")

and there's only one function: install_wheels_venv(wheels: List[str], venv: str), where wheels is a list of paths to wheel files and venv is the location of the venv to install the packages in.

See monotrail for benchmarks.