-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pyenv to uv based python and venv (#303)
* switch pyenv to uv * resolve issues * remove uv upgrade * switch to uv * remove comment * remove python version * remove python3.12-dev * remove empty line * use python3.pc * test github workflow * switch to pyqt-5 + use uv python for pkgconfig * remove references to pyenv * add python2 * [upload] * resolve docker warnings * [upload] * setup uv to use /usr/local * use uv to install pyqt5 * use uv to install pip * use --seed to setup pip * test build using --no-deps * test build pyqt5 using pyproject.toml * revert pyqt5 from pyproject.toml * [upload] * use PyQt5 wheel * revert duplicate openpilot_dependencies.sh installed in agnos-base * add sudo * revert dev deps purge * remove openpilot_dependencies.sh from agnos-base * add -y to apt-get * add pyproject opencl dep * add gcc-arm-none-eabi dep * test removing dev dependencies * test removing dev dependencies * test purge using noninteractive * test autoremove dependencies * revert autoremove * add pip to handle pip install * add new line * rebuild * use uv python 3.12.3 * test github runner * revert github runner * rebuild * set pc path to python 3.12 * rebuild pyqt5 in Docker * test rebuild pyqt5 * rebuild pyqt5 * rebuild pyqt5 * test build pyqt5 wheel * resolve venv * test rebuild pyqt5 wheel * resolve build error * use pip to build wheel * use prebuilt pyqt5 wheel * move dbus-python deps * resolve PR comments * test remove dbus-python deps * remove dbus-python deps * remove pyqt5 pre-built wheel * test uv python venv * add quotes * add shims * rebuild * remove XDG_DATA_HOME * rebuild * add uv shim * chmod +x uv * set UV_NO_CACHE=1 * remove trailing whitespace * resolve uv device issues * rebuild
- Loading branch information
Showing
10 changed files
with
54 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,14 @@ | ||
#!/bin/bash -e | ||
|
||
echo "Installing python for openpilot" | ||
echo "installing uv..." | ||
|
||
# Install pyenv | ||
export PYENV_ROOT="/usr/local/pyenv" | ||
curl https://pyenv.run | bash | ||
export PATH="$PYENV_ROOT/bin:$PATH" | ||
eval "$(pyenv init -)" | ||
export XDG_DATA_HOME="/usr/local" | ||
export CARGO_HOME="$XDG_DATA_HOME/.cargo" | ||
|
||
PYTHON_VERSION="3.11.4" | ||
if [ "$(uname -p)" == "aarch64" ]; then | ||
pyenv install --verbose $PYTHON_VERSION | ||
else | ||
MAKEFLAGS="-j1" MAKE_OPTS="-j1" taskset --cpu-list 0 pyenv install --verbose $PYTHON_VERSION | ||
fi | ||
curl -LsSf https://astral.sh/uv/install.sh | sh | ||
eval ". $CARGO_HOME/env" | ||
|
||
echo "Setting global python version" | ||
pyenv global $PYTHON_VERSION | ||
PYTHON_VERSION="3.12.3" | ||
|
||
pip3 install --no-cache-dir --upgrade pip uv | ||
# uv requires virtual env either managed or system before installing dependencies | ||
uv venv $XDG_DATA_HOME/venv --seed --python-preference only-managed --python=$PYTHON_VERSION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/bash | ||
|
||
UV_PATH=/usr/local/.cargo/bin/uv | ||
export TMPDIR=/tmp/uv-tmp | ||
|
||
# setup large tmp for install | ||
mkdir -p $TMPDIR | ||
sudo mount -o remount,size=2G /tmp | ||
sudo mount -o rw,remount / | ||
sudo resize2fs $(findmnt -n -o SOURCE /) &>/dev/null || sudo resize2fs $(findmnt -n -o SOURCE /) | ||
|
||
# run command | ||
sudo -E TMPDIR=$TMPDIR UV_NO_CACHE=1 $UV_PATH "$@" | ||
|
||
# cleanup | ||
sudo mount -o ro,remount / | ||
sudo rm -rf $TMPDIR | ||
sudo mount -o remount /tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters