Skip to main content

Add a script for installing pip dependencies with uv

ID
9f1da0c
date
2024-06-02 09:23:00+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
6d5b8bc
message
Add a script for installing pip dependencies with uv
changed files
2 files, 19 additions, 1 deletion

Changed files

fish_functions/README.md (3858) → fish_functions/README.md (4085)

diff --git a/fish_functions/README.md b/fish_functions/README.md
index e5db2dd..06f3057 100644
--- a/fish_functions/README.md
+++ b/fish_functions/README.md
@@ -105,6 +105,15 @@ cog_helpers.create_description_table(folder_name=folder_name, scripts=functions)
   </dd>
 
   <dt>
+    <a href="https://github.com/alexwlchan/scripts/blob/main/fish_functions/pip_sync.fish">
+      <code>pip_sync.fish</code>
+    </a>
+  </dt>
+  <dd>
+    Make a virtualenv dependencies look like requirements.txt
+  </dd>
+
+  <dt>
     <a href="https://github.com/alexwlchan/scripts/blob/main/fish_functions/pyfmt.fish">
       <code>pyfmt.fish</code>
     </a>
@@ -140,4 +149,4 @@ cog_helpers.create_description_table(folder_name=folder_name, scripts=functions)
     Create and activate a new virtual environment
   </dd>
 </dl>
-<!-- [[[end]]] (checksum: b252f415053e97cb4e0110ae9131b55e) -->
\ No newline at end of file
+<!-- [[[end]]] (checksum: e9c834ba6a3e6dce919939efbe5deaad) -->
\ No newline at end of file

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

diff --git a/fish_functions/pip_sync.fish b/fish_functions/pip_sync.fish
new file mode 100644
index 0000000..3049c27
--- /dev/null
+++ b/fish_functions/pip_sync.fish
@@ -0,0 +1,9 @@
+function pip_sync --description "Make a virtualenv dependencies look like requirements.txt"
+    pip_compile
+
+    if test \( -e dev_requirements.txt \)
+        uv pip sync dev_requirements.txt
+    else if test \( -e requirements.txt \)
+        uv pip sync requirements.txt
+    end
+end