From 7f07cee136299271ebc4f0b53b5a425074235eed Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Thu, 4 Apr 2024 00:21:53 -0400 Subject: [PATCH] Document that uv is safe to run concurrently --- README.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a00d547bb0a2..74ba5ef93783 100644 --- a/README.md +++ b/README.md @@ -261,8 +261,18 @@ The specifics of uv's caching semantics vary based on the nature of the dependen - **For Git dependencies**, uv caches based on the fully-resolved Git commit hash. As such, `uv pip compile` will pin Git dependencies to a specific commit hash when writing the resolved dependency set. -- **For local dependencies**, uv caches based on the last-modified time of the `setup.py` or - `pyproject.toml` file. +- **For local dependencies**, uv caches based on the last-modified time of the source archive (i.e., + the local `.whl` or `.tar.gz` file). For directories, uv caches based on the last-modified time of + the `pyproject.toml`, `setup.py`, or `setup.cfg` file. + +It's safe to run multiple `uv` commands concurrently, even against the same virtual environment. +uv's cache is designed to be thread-safe and append-only, and thus robust to multiple concurrent +readers and writers. uv applies a file-based lock to the target virtual environment when installing, +to avoid concurrent modifications across processes. + +Note that it's _not_ safe to modify the uv cache directly (e.g., `uv cache clean`) while other `uv` +commands are running, and _never_ safe to modify the cache directly (e.g., by removing a file or +directory). If you're running into caching issues, uv includes a few escape hatches: