pip_sync: move the UV_LINK_MODE check to the Python script
- ID
eebe395- date
2026-05-14 05:50:27+00:00- author
Alex Chan <alex@alexwlchan.net>- parent
f068fb3- message
pip_sync: move the UV_LINK_MODE check to the Python script- changed files
2 files, 17 additions, 17 deletions
Changed files
fish_functions/pip_sync.fish (1242) → fish_functions/pip_sync.fish (585)
diff --git a/fish_functions/pip_sync.fish b/fish_functions/pip_sync.fish
index f615ce5..b2a1d8e 100644
--- a/fish_functions/pip_sync.fish
+++ b/fish_functions/pip_sync.fish
@@ -14,22 +14,6 @@ function pip_sync --description "Make a virtualenv dependencies look like requir
echo ""
end
- # If we're on an external disk, disable the warning about being
- # unable to clone files. In particular:
- #
- # warning: Failed to clone files; falling back to full copy.
- # This may lead to degraded performance. If the cache and target
- # directories are on different filesystems, reflinking may not
- # be supported.
- #
- # If this is intentional, set `export UV_LINK_MODE=copy` or use
- # `--link-mode=copy` to suppress this warning.
- #
- # On macOS, this means "are you in a path that starts with /Volumes".
- if string match -q "/Volumes/*" "$PWD"
- set -x UV_LINK_MODE copy
- end
-
# Actually run the `uv pip sync` command.
run_pip_sync $argv
end
python/run_pip_sync (879) → python/run_pip_sync (1566)
diff --git a/python/run_pip_sync b/python/run_pip_sync
index 47727f3..8fce91c 100755
--- a/python/run_pip_sync
+++ b/python/run_pip_sync
@@ -5,13 +5,29 @@ Run `uv pip sync` with a `requirements.txt` file in the current folder.
This will pick which file to use.
"""
+import os
from pathlib import Path
import shlex
import subprocess
import sys
-if __name__ == "__main__":
+if __name__ == "__main__":
+ # If we're on an external disk, disable the warning about being
+ # unable to clone files. In particular:
+ #
+ # warning: Failed to clone files; falling back to full copy.
+ # This may lead to degraded performance. If the cache and target
+ # directories are on different filesystems, reflinking may not
+ # be supported.
+ #
+ # If this is intentional, set `export UV_LINK_MODE=copy` or use
+ # `--link-mode=copy` to suppress this warning.
+ #
+ # On macOS, this means "are you in a path that starts with /Volumes".
+ if os.getcwd().startswith("/Volumes/"):
+ os.environ.update({"UV_LINK_MODE": "copy"})
+
# If a dev_requirements.txt file is available, use that, otherwise use
# the standard `requirements.txt`.
if Path("dev_requirements.txt").exists():