uv
fa432888 - Use environment layering for `uv run --with` (#3447)

Commit
1 year ago
Use environment layering for `uv run --with` (#3447) ## Summary This PR takes a different approach to `--with` for `uv run`. Now, instead of merging the requirements and re-resolving, we have two phases: (1) sync the workspace requirements to the workspace environment; then (2) sync the ephemeral `--with` requirements to an ephemeral environment. The two environments are then layered by setting the `PATH` and `PYTHONPATH` variables appropriately. I think this approach simplifies a few things: 1. Once we have a lockfile, the semantics are much clearer, and we can actually reuse it for the workspace. If we had to add arbitrary dependencies via `--with`, then it's not really clear how the lockfile would/should behave. 2. Caching becomes simpler, because we can just cache the ephemeral environment based on the requirements. The current version of this PR loses a few behaviors though that I need to restore: - `--python` support -- but I'm not yet sure how this is supposed to behave within projects? It's also left unclear in `uv sync` and `uv lock`. - The "reuse the workspace environment if it already satisfies the ephemeral requirements" behavior. Closes #3411.
Author
Parents
Loading