Skip to main content

pip_sync: if there isn’t a virtualenv already, create one

ID
f16c510
date
2024-06-02 09:42:18+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
9f1da0c
message
pip_sync: if there isn't a virtualenv already, create one
changed files
1 file, 5 additions

Changed files

fish_functions/pip_sync.fish (284) → fish_functions/pip_sync.fish (390)

diff --git a/fish_functions/pip_sync.fish b/fish_functions/pip_sync.fish
index 3049c27..196f7a3 100644
--- a/fish_functions/pip_sync.fish
+++ b/fish_functions/pip_sync.fish
@@ -1,6 +1,11 @@
 function pip_sync --description "Make a virtualenv dependencies look like requirements.txt"
     pip_compile
 
+    # If there isn't a virtualenv already, create one
+    if test -z "$VIRTUAL_ENV"
+        venv
+    end
+
     if test \( -e dev_requirements.txt \)
         uv pip sync dev_requirements.txt
     else if test \( -e requirements.txt \)