Skip to main content

Speed up the venv command in temporary directories

ID
8f49af3
date
2025-04-23 07:07:42+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
445dfd1
message
Speed up the `venv` command in temporary directories
changed files
1 file, 6 additions, 1 deletion

Changed files

fish_functions/venv.fish (961) → fish_functions/venv.fish (1142)

diff --git a/fish_functions/venv.fish b/fish_functions/venv.fish
index 7544e10..4327dd4 100644
--- a/fish_functions/venv.fish
+++ b/fish_functions/venv.fish
@@ -27,5 +27,10 @@ function venv --description "Create and activate a new virtual environment"
 
     # Tell Time Machine that it doesn't need to both backing up the
     # virtualenv directory.
-    tmutil addexclusion .venv
+    #
+    # Note: this is quite slow, so we only run it if we're in my home
+    # directory -- it won't get backed up otherwise.
+    if string match -q "$HOME/*" "$PWD"
+        tmutil addexclusion .venv
+    end
 end