Skip to content

Commit d62b360

Browse files
authored
infra: allow rerun make install without prompt (#2979)
<!-- Thanks for opening a pull request! --> <!-- In the case this PR will resolve an issue, please replace ${GITHUB_ISSUE_ID} below with the actual Github issue id. --> <!-- Closes #${GITHUB_ISSUE_ID} --> # Rationale for this change This PR lets `uv` manage the virtual env. uv will only setup a new venv if it does not exist and sync dep only when necessary. This should make the entire `make install` process a lot faster and easier to work with ### Context I noticed running `make install` when a `.venv` already existed would show an interactive prompt: ``` ➜ make install uv is already installed. uv venv Using CPython 3.12.11 interpreter at: /Users/kevinliu/.pyenv/versions/3.12.11/bin/python3 Creating virtual environment at: .venv ? A virtual environment already exists at `.venv`. Do you want to replace it? [y/n] › yes hint: Use the `--clear` flag or set `UV_VENV_CLEAR=1` to skip this prompt ``` We dont need this prompt. And more crucially, claude keeps on getting stuck on this prompt 😞 ## Are these changes tested? Yes running `make install` repeatedly ## Are there any user-facing changes? <!-- In the case of user-facing changes, please add the changelog label. -->
1 parent d770166 commit d62b360

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

.github/workflows/python-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
- name: Install system dependencies
6363
run: sudo apt-get update && sudo apt-get install -y libkrb5-dev # for kerberos
6464
- name: Install
65-
run: make install-dependencies
65+
run: make install
6666
- name: Run linters
6767
run: make lint
6868
- name: Run unit tests with coverage

Makefile

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,17 @@ install-uv: ## Ensure uv is installed
6666
echo "uv is already installed."; \
6767
fi
6868

69-
setup-venv: ## Create virtual environment
70-
uv venv $(PYTHON_ARG)
71-
72-
install-dependencies: setup-venv ## Install all dependencies including extras
73-
uv sync $(PYTHON_ARG) --all-extras --reinstall
74-
75-
install-hooks: ## Install pre-commit hooks (skipped outside git repo, e.g. release tarballs)
76-
@if [ -d .git ]; then uv run $(PYTHON_ARG) prek install; fi
77-
78-
install: install-uv install-dependencies install-hooks ## Install uv, dependencies, and pre-commit hooks
69+
install: install-uv ## Install uv, dependencies, and pre-commit hooks
70+
uv sync $(PYTHON_ARG) --all-extras
71+
@# Reinstall pyiceberg if Cython extensions (.so) are missing after `make clean` (see #2869)
72+
@if ! find pyiceberg -name "*.so" 2>/dev/null | grep -q .; then \
73+
echo "Cython extensions not found, reinstalling pyiceberg..."; \
74+
uv sync $(PYTHON_ARG) --all-extras --reinstall-package pyiceberg; \
75+
fi
76+
@# Install pre-commit hooks (skipped outside git repo, e.g. release tarballs)
77+
@if [ -d .git ]; then \
78+
uv run $(PYTHON_ARG) prek install; \
79+
fi
7980

8081
# ===============
8182
# Code Validation

0 commit comments

Comments
 (0)