Skip to content

Commit 66a8a0e

Browse files
feat: Globally install uv (#60)
* Globally install uv instead of installing it in the Python virtual environment. This simplifies workflows and gets people using uv more. * Note that curl is an added required dependency.
1 parent 14a5c16 commit 66a8a0e

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ Package Version
9999
---------- -------
100100
pip 24.0
101101
setuptools 69.5.1
102-
uv 0.1.42
103102
(lcg-example) [feickert@lxplus924 ~]$ python -m pip show hepdata-lib # Still have full LCG view
104103
Name: hepdata-lib
105104
Version: 0.12.0
@@ -143,7 +142,6 @@ packaging 24.0
143142
pip 24.0
144143
setuptools 69.5.1
145144
typing_extensions 4.11.0
146-
uv 0.1.42
147145
zipp 3.18.1
148146
(lcg-example) [feickert@lxplus924 ~]$ uv pip list # uv will show the same view
149147
Package Version
@@ -157,7 +155,6 @@ packaging 24.0
157155
pip 24.0
158156
setuptools 69.5.1
159157
typing-extensions 4.11.0
160-
uv 0.1.42
161158
zipp 3.18.1
162159
(lcg-example) [feickert@lxplus924 ~]$ deactivate # Resets PYTHONPATH given added hooks
163160
[feickert@lxplus924 ~]$ python -m pip show awkward # Get CVMFS's old version
@@ -179,6 +176,7 @@ Required-by: cabinetry, coffea, servicex, uproot_browser
179176

180177
A full listing of all programs used outside of Bash shell builtins are:
181178
* `cat`
179+
* `curl`
182180
* `ed` or `vi`
183181
* `find`
184182
* `readlink`

cvmfs-venv.sh

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,29 @@ fi
435435

436436
# Install uv by default
437437
if [ -z "${_no_uv}" ]; then
438-
python -m pip --quiet --no-cache-dir install --upgrade uv &> /dev/null
438+
# Ensure that uv is installed
439+
if ! command -v uv >/dev/null 2>&1; then
440+
echo "# Installing uv"
441+
# Check if pixi exists
442+
if command -v pixi >/dev/null 2>&1; then
443+
# Use pixi global
444+
echo "# Installing uv with pixi global"
445+
echo "# You can update uv with 'pixi global update uv'"
446+
pixi global install uv
447+
else
448+
# Install from https://astral.sh/
449+
echo "# Installing from https://astral.sh/"
450+
echo "# You can update uv with 'uv self update'"
451+
curl -LsSf https://astral.sh/uv/install.sh | sh
452+
fi
453+
454+
# Ensure ~/.local/bin is on the PATH for uv
455+
if [[ ":$PATH:" != *":${HOME}/.local/bin:"* ]]; then
456+
export PATH="${HOME}/.local/bin:${PATH}"
457+
fi
458+
# Enable uv shell autocompletion
459+
eval "$(uv generate-shell-completion bash)"
460+
fi
439461
fi
440462

441463
# Get latest pip and setuptools

0 commit comments

Comments
 (0)