Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: use uv #474

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading