Update setup script to use uv

This commit is contained in:
Jesse Hills 2025-04-22 08:31:41 +12:00
parent 33c5b97cf8
commit dbf14a8ceb
No known key found for this signature in database
GPG Key ID: BEAAE804EFD8E83A

View File

@ -4,25 +4,28 @@
set -e set -e
cd "$(dirname "$0")/.." cd "$(dirname "$0")/.."
location="venv/bin/activate"
if [ ! -n "$DEVCONTAINER" ] && [ ! -n "$VIRTUAL_ENV" ] && [ ! "$ESPHOME_NO_VENV" ]; then if [ ! -n "$DEVCONTAINER" ] && [ ! -n "$VIRTUAL_ENV" ] && [ ! "$ESPHOME_NO_VENV" ]; then
python3 -m venv venv if [ -x "$(command -v uv)" ]; then
if [ -f venv/Scripts/activate ]; then uv venv venv
location="venv/Scripts/activate" else
python3 -m venv venv
fi fi
source $location source venv/bin/activate
fi fi
pip3 install -r requirements.txt -r requirements_test.txt -r requirements_dev.txt if ! [ -x "$(command -v uv)" ]; then
pip3 install setuptools wheel python3 -m pip install uv
pip3 install -e ".[dev,test]" --config-settings editable_mode=compat fi
uv pip install setuptools wheel
uv pip install -e ".[dev,test]" --config-settings editable_mode=compat
pre-commit install pre-commit install
script/platformio_install_deps.py platformio.ini --libraries --tools --platforms script/platformio_install_deps.py platformio.ini --libraries --tools --platforms
mkdir .temp mkdir -p .temp
echo echo
echo echo
echo "Virtual environment created. Run 'source $location' to use it." echo "Virtual environment created. Run 'source venv/bin/activate' to use it."