From dbf14a8ceb4f80e8df83ec5d9f70f4db6041d0c0 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Tue, 22 Apr 2025 08:31:41 +1200 Subject: [PATCH] Update setup script to use uv --- script/setup | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/script/setup b/script/setup index 0faa746f3a..acc2ec58b4 100755 --- a/script/setup +++ b/script/setup @@ -4,25 +4,28 @@ set -e cd "$(dirname "$0")/.." -location="venv/bin/activate" if [ ! -n "$DEVCONTAINER" ] && [ ! -n "$VIRTUAL_ENV" ] && [ ! "$ESPHOME_NO_VENV" ]; then - python3 -m venv venv - if [ -f venv/Scripts/activate ]; then - location="venv/Scripts/activate" + if [ -x "$(command -v uv)" ]; then + uv venv venv + else + python3 -m venv venv fi - source $location + source venv/bin/activate fi -pip3 install -r requirements.txt -r requirements_test.txt -r requirements_dev.txt -pip3 install setuptools wheel -pip3 install -e ".[dev,test]" --config-settings editable_mode=compat +if ! [ -x "$(command -v uv)" ]; then + python3 -m pip install uv +fi + +uv pip install setuptools wheel +uv pip install -e ".[dev,test]" --config-settings editable_mode=compat pre-commit install script/platformio_install_deps.py platformio.ini --libraries --tools --platforms -mkdir .temp +mkdir -p .temp echo echo -echo "Virtual environment created. Run 'source $location' to use it." +echo "Virtual environment created. Run 'source venv/bin/activate' to use it."