mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 21:35:00 +00:00
![]() ## Summary This PR adds a `--python` flag that allows users to provide a specific Python interpreter into which `uv` should install packages. This would replace the `VIRTUAL_ENV=` workaround that folks have been using to install into arbitrary, system environments, while _also_ actually being correct for installing into non-virtual environments, where the bin and site-packages paths can differ. The approach taken here is to use `sysconfig.get_paths()` to get the correct paths from the interpreter, and then use those for determining the `bin` and `site-packages` directories, rather than constructing them based on hard-coded expectations for each platform. Closes https://github.com/astral-sh/uv/issues/1396. Closes https://github.com/astral-sh/uv/issues/1779. Closes https://github.com/astral-sh/uv/issues/1988. ## Test Plan - Verified that, on my Windows machine, I was able to install `requests` into a global environment with: `cargo run pip install requests --python 'C:\\Users\\crmarsh\\AppData\\Local\\Programs\\Python\\Python3.12\\python.exe`, then `python` and `import requests`. - Verified that, on macOS, I was able to install `requests` into a global environment installed via Homebrew with: `cargo run pip install requests --python $(which python3.8)`. |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
Readme.md |
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.