mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 19:08:04 +00:00
Use a stable directory for (local) script virtual environments (#11347)
## Summary Today, scripts use `CachedEnvironment`, which results in a different virtual environment path every time the interpreter changes _or_ the project requirements change. This makes it impossible to provide users with a stable path to the script that they can use for (e.g.) directing their editor. This PR modifies `uv run` to use a stable path for local scripts (we continue to use `CachedEnvironment` for remote scripts and scripts from `stdin`). The logic now looks a lot more like it does for projects: we `get_or_init` an environment, etc. For now, the path to the script is like: `environments-v1/4485801245a4732f`, where `4485801245a4732f` is a SHA of the absolute path to the script. But I'm not picky on that :)
This commit is contained in:
parent
ba5efa8aa4
commit
79ad7a1ab9
7 changed files with 430 additions and 196 deletions
|
@ -65,7 +65,7 @@ impl Pep723Item {
|
|||
}
|
||||
|
||||
/// A reference to a PEP 723 item.
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub enum Pep723ItemRef<'item> {
|
||||
/// A PEP 723 script read from disk.
|
||||
Script(&'item Pep723Script),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue