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
This commit is contained in:
Bryce 2024-03-05 19:39:33 -08:00 committed by Bryce Drennan
parent e6a1c988c5
commit a8acb451c5
3 changed files with 25 additions and 25 deletions

View File

@ -45,12 +45,14 @@ jobs:
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
python-version: "3.10" python-version: "3.10"
# cache: pip cache: pip
# cache-dependency-path: requirements-dev.txt cache-dependency-path: requirements-dev.txt
- name: Install dependencies - name: Install dependencies
run: | run: |
python -m pip uninstall torch torchvision xformers triton imaginairy -y python -m pip install uv
python -m pip install -r requirements-dev.in . --upgrade uv pip uninstall --system torch torchvision xformers triton imaginairy
uv pip sync --system requirements-dev.txt
pip install -e .
- name: Test with pytest - name: Test with pytest
timeout-minutes: 30 timeout-minutes: 30
env: env:
@ -79,7 +81,9 @@ jobs:
cache-dependency-path: requirements-dev.txt cache-dependency-path: requirements-dev.txt
- name: Install dependencies - name: Install dependencies
run: | 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 - name: Test with pytest
timeout-minutes: 30 timeout-minutes: 30
env: env:

View File

@ -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. init: require_pyenv ## Setup a dev environment for local development.
@pyenv install $(python_version) -s @pyenv install $(python_version) -s
@echo -e "\033[0;32m ✔️ 🐍 $(python_version) installed \033[0m" @echo -e "\033[0;32m ✔️ 🐍 $(python_version) installed \033[0m"
@if ! [ -d "$$(pyenv root)/versions/$(venv_name)" ]; then\ @if ! [ -d "$$(pyenv root)/versions/$(venv_name)" ]; then \
pyenv virtualenv $(python_version) $(venv_name);\ pyenv virtualenv $(python_version) $(venv_name); \
fi; fi
@pyenv local $(venv_name) @pyenv local $(venv_name)
@echo -e "\033[0;32m ✔️ 🐍 $(venv_name) virtualenv activated \033[0m" @echo -e "\033[0;32m ✔️ 🐍 $(venv_name) virtualenv activated \033[0m"
pip install --upgrade pip pip-tools @export VIRTUAL_ENV=$$(pyenv prefix); \
pip-sync requirements-dev.txt if command -v uv >/dev/null 2>&1; then \
pip install -e . uv pip install --upgrade uv; \
# the compiled requirements don't included OS specific subdependencies so we trigger those this way else \
#pip install `pip freeze | grep "^torch=="` pip install --upgrade pip uv; \
@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" fi; \
@echo -e "\033[0;32m" uv pip sync requirements-dev.txt; \
@pyenv which python uv pip install -e .
@echo -e "\n\033[0m" @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 "The following commands are available to run in the Makefile\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 @make -s help
af: autoformat ## Alias for `autoformat` af: autoformat ## Alias for `autoformat`
autoformat: ## Run the autoformatter. autoformat: ## Run the autoformatter.
@-ruff check --config tests/ruff.toml . --fix-only @-ruff check --config tests/ruff.toml . --fix-only
@ -84,12 +86,6 @@ require_pyenv:
else\ else\
echo -e "\033[0;32m ✔️ pyenv installed\033[0m";\ echo -e "\033[0;32m ✔️ pyenv installed\033[0m";\
fi 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 .PHONY: docs

View File

@ -24,7 +24,7 @@ def test_clip_masking(filename_base_for_outputs):
img_path = f"{filename_base_for_outputs}_mask{mask_modifier}_g.png" img_path = f"{filename_base_for_outputs}_mask{mask_modifier}_g.png"
assert_image_similar_to_expectation( 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" img_path = f"{filename_base_for_outputs}_mask{mask_modifier}_bin.png"