uv/crates/uv-python
konsti bf96c60e3e
Lock during uv sync, uv add and uv remove to avoid race conditions (#13869)
Surprisingly, we weren't locking during `uv sync` so far, so running `uv
sync` in parallel could cause errors in filesystem races.

I've also added locks to `uv add` and `uv remove` which concurrently
modify `pyproject.toml`. These locks only apply after we determined the
interpreter, so they don't actually prevent computing the same thing
twice when running `uv add` in parallel.

All other subcommands that I checked were already locking (with no claim
to exhaustiveness)

Fixes #12751

# Test Plan

I don't have CI-sized reproducer for this.

```toml
[project]
name = "debug"
version = "0.1.0"
requires-python = ">=3.12"
dependencies = [
  "boto3>=1.38.30",
  "fastapi>=0.115.12",
  "numba>=0.61.2",
  "polars>=1.30.0",
  "protobuf>=6.31.1",
  "pyarrow>=20.0.0",
  "pydantic>=2.11.5",
  "requests>=2.32.3",
  "urllib3>=2.4.0",
  "scikit-learn>=1.6.1",
  "jupyter>=1.1.1",
]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
```

```
rm -rf .venv && parallel -n0 "uv sync -q" ::: {1..10}
```
2025-06-06 14:16:40 +02:00
..
python Add Pyodide support (#12731) 2025-06-03 12:01:26 -05:00
src Lock during uv sync, uv add and uv remove to avoid race conditions (#13869) 2025-06-06 14:16:40 +02:00
.gitignore minify and filter embed managed pythons json on compile time (#12967) 2025-04-30 15:51:03 -04:00
build.rs Only rebuild download JSON on change (#13261) 2025-05-02 07:49:34 -05:00
Cargo.toml Add DisplaySafeUrl newtype to prevent leaking of credentials by default (#13560) 2025-05-27 00:05:30 +02:00
download-metadata.json Sync latest Python releases (#13848) 2025-06-04 19:07:04 +00:00
fetch-download-metadata.py update python build standalone, unblocklist linux updates (#13732) 2025-05-30 12:33:21 -04:00