File tree Expand file tree Collapse file tree 1 file changed +21
-7
lines changed
Expand file tree Collapse file tree 1 file changed +21
-7
lines changed Original file line number Diff line number Diff line change @@ -119,13 +119,7 @@ test:
119119 TORCHVISION_VERSION=0.17.0+cu118
120120 fi
121121 - |
122- if grep -q "tool.uv" pyproject.toml; then
123- echo "[tool.uv] already exists in pyproject.toml"
124- exit 1
125- fi
126- - |
127- cat <<EOF >> pyproject.toml
128-
122+ cat <<EOF >> pyproject.toml.delta
129123 [tool.uv]
130124 override-dependencies = [
131125 "torch==$TORCH_VERSION",
@@ -140,7 +134,27 @@ test:
140134 name = "pytorch-$CUDA_VERSION_NAME"
141135 url = "https://download.pytorch.org/whl/$CUDA_VERSION_NAME"
142136 explicit = true
137+ EOF
138+ - uv pip install tomlkit
139+ - |
140+ uv run --no-sync python <<EOF
141+ from collections.abc import MutableMapping
142+ from pathlib import Path
143+ import tomlkit
144+
145+ def update_dict(d, d2):
146+ for k, v in d2.items():
147+ if k not in d:
148+ d[k] = v
149+ elif isinstance(d[k], MutableMapping) and isinstance(v, MutableMapping):
150+ update_dict(d[k], v)
151+ else:
152+ d[k] = v
143153
154+ base = tomlkit.parse(Path("pyproject.toml").read_text())
155+ delta = tomlkit.parse(Path("pyproject.toml.delta").read_text())
156+ update_dict(base, delta)
157+ Path("pyproject.toml").write_text(tomlkit.dumps(base))
144158 EOF
145159 - uv sync --group=test
146160 - *check-torch-cuda
You can’t perform that action at this time.
0 commit comments