From a8acb451c56eebbf76f92ee6968b4007379803eb Mon Sep 17 00:00:00 2001 From: Bryce Date: Tue, 5 Mar 2024 19:39:33 -0800 Subject: [PATCH] ci: use `uv` waiting for this issue to be resolved before using it for pip-compile https://github.com/astral-sh/uv/issues/1624 and it didn't properly install the command line tools `aimg` and `imagine` so not using it for editable install on github either --- .github/workflows/ci.yaml | 14 ++++++---- Makefile | 34 ++++++++++------------- tests/test_enhancers/test_clip_masking.py | 2 +- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6693266b..cda61f7d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -45,12 +45,14 @@ jobs: uses: actions/setup-python@v4 with: python-version: "3.10" -# cache: pip -# cache-dependency-path: requirements-dev.txt + cache: pip + cache-dependency-path: requirements-dev.txt - name: Install dependencies run: | - python -m pip uninstall torch torchvision xformers triton imaginairy -y - python -m pip install -r requirements-dev.in . --upgrade + python -m pip install uv + uv pip uninstall --system torch torchvision xformers triton imaginairy + uv pip sync --system requirements-dev.txt + pip install -e . - name: Test with pytest timeout-minutes: 30 env: @@ -79,7 +81,9 @@ jobs: cache-dependency-path: requirements-dev.txt - name: Install dependencies run: | - python -m pip install -r requirements-dev.in . --upgrade + python -m pip install uv + uv pip sync --system requirements-dev.txt + pip install -e . - name: Test with pytest timeout-minutes: 30 env: diff --git a/Makefile b/Makefile index cb7fccb1..860bffb1 100644 --- a/Makefile +++ b/Makefile @@ -9,23 +9,25 @@ pyenv_virt_instructions=https://github.com/pyenv/pyenv-virtualenv#pyenv-virtuale init: require_pyenv ## Setup a dev environment for local development. @pyenv install $(python_version) -s @echo -e "\033[0;32m ✔️ 🐍 $(python_version) installed \033[0m" - @if ! [ -d "$$(pyenv root)/versions/$(venv_name)" ]; then\ - pyenv virtualenv $(python_version) $(venv_name);\ - fi; + @if ! [ -d "$$(pyenv root)/versions/$(venv_name)" ]; then \ + pyenv virtualenv $(python_version) $(venv_name); \ + fi @pyenv local $(venv_name) @echo -e "\033[0;32m ✔️ 🐍 $(venv_name) virtualenv activated \033[0m" - pip install --upgrade pip pip-tools - pip-sync requirements-dev.txt - pip install -e . - # the compiled requirements don't included OS specific subdependencies so we trigger those this way - #pip install `pip freeze | grep "^torch=="` - @echo -e "\nEnvironment setup! ✨ 🍰 ✨ 🐍 \n\nCopy this path to tell PyCharm where your virtualenv is. You may have to click the refresh button in the pycharm file explorer.\n" - @echo -e "\033[0;32m" - @pyenv which python - @echo -e "\n\033[0m" - @echo -e "The following commands are available to run in the Makefile\n" + @export VIRTUAL_ENV=$$(pyenv prefix); \ + if command -v uv >/dev/null 2>&1; then \ + uv pip install --upgrade uv; \ + else \ + pip install --upgrade pip uv; \ + fi; \ + uv pip sync requirements-dev.txt; \ + uv pip install -e . + @echo -e "\nEnvironment setup! ✨ 🍰 ✨ 🐍 \n\nCopy this path to tell PyCharm where your virtualenv is. You may have to click the refresh button in the PyCharm file explorer.\n" + @echo -e "\033[0;32m$$(pyenv which python)\033[0m\n" + @echo -e "The following commands are available to run in the Makefile:\n" @make -s help + af: autoformat ## Alias for `autoformat` autoformat: ## Run the autoformatter. @-ruff check --config tests/ruff.toml . --fix-only @@ -84,12 +86,6 @@ require_pyenv: else\ echo -e "\033[0;32m ✔️ pyenv installed\033[0m";\ fi - @if ! [[ "$$(pyenv virtualenv --version)" == *"pyenv-virtualenv"* ]]; then\ - echo -e '\n\033[0;31m ❌ pyenv virtualenv is not installed. Follow instructions here: $(pyenv_virt_instructions) \n\033[0m';\ - exit 1;\ - else\ - echo -e "\033[0;32m ✔️ pyenv-virtualenv installed\033[0m";\ - fi .PHONY: docs diff --git a/tests/test_enhancers/test_clip_masking.py b/tests/test_enhancers/test_clip_masking.py index 2f215c97..1cde49c6 100644 --- a/tests/test_enhancers/test_clip_masking.py +++ b/tests/test_enhancers/test_clip_masking.py @@ -24,7 +24,7 @@ def test_clip_masking(filename_base_for_outputs): img_path = f"{filename_base_for_outputs}_mask{mask_modifier}_g.png" assert_image_similar_to_expectation( - pred_grayscale, img_path=img_path, threshold=300 + pred_grayscale, img_path=img_path, threshold=450 ) img_path = f"{filename_base_for_outputs}_mask{mask_modifier}_bin.png"