Skip to content

Commit eb6b346

Browse files
refactor: Simplify Makefile with consistent uv run usage
Replace complex venv detection logic with unified uv run commands: - format-python: Use uv run ruff from project root - lint-python: Use uv run for ruff and mypy consistently - test-python-*: Standardize all test targets with uv run This eliminates environment-specific conditionals and ensures consistent behavior across local development and CI environments. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 6bc12c2 commit eb6b346

File tree

1 file changed

+21
-28
lines changed

1 file changed

+21
-28
lines changed

Makefile

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ protos: compile-protos-python compile-protos-docs ## Compile protobufs for Pytho
5555
build: protos build-docker ## Build protobufs and Docker images
5656

5757
format-python: ## Format Python code
58-
cd $(ROOT_DIR)/sdk/python && ([ -f .venv/bin/ruff ] && .venv/bin/ruff check --fix feast/ tests/ || ruff check --fix feast/ tests/)
59-
cd $(ROOT_DIR)/sdk/python && ([ -f .venv/bin/ruff ] && .venv/bin/ruff format feast/ tests/ || ruff format feast/ tests/)
58+
cd $(ROOT_DIR) && uv run ruff check --fix sdk/python/feast/ sdk/python/tests/
59+
cd $(ROOT_DIR) && uv run ruff format sdk/python/feast/ sdk/python/tests/
6060

6161
lint-python: ## Lint Python code
62-
cd $(ROOT_DIR)/sdk/python && ([ -f .venv/bin/ruff ] && .venv/bin/ruff check feast/ tests/ || ruff check feast/ tests/)
63-
cd $(ROOT_DIR)/sdk/python && ([ -f .venv/bin/mypy ] && .venv/bin/mypy feast || mypy feast)
62+
cd $(ROOT_DIR) && uv run ruff check sdk/python/feast/ sdk/python/tests/
63+
cd $(ROOT_DIR) && uv run sh -c "cd sdk/python && mypy feast"
6464

6565
# New combined target
6666
precommit-check: format-python lint-python ## Run all precommit checks
@@ -74,7 +74,7 @@ install-precommit: ## Install precommit hooks (runs on commit, not push)
7474

7575
# Manual full type check
7676
mypy-full: ## Full MyPy type checking with all files
77-
cd ${ROOT_DIR}/sdk/python && uv run --no-project mypy feast tests
77+
cd ${ROOT_DIR} && uv run sh -c "cd sdk/python && mypy feast tests"
7878

7979
# Run precommit on all files
8080
precommit-all: ## Run all precommit hooks on all files
@@ -170,40 +170,33 @@ benchmark-python-local: ## Run integration + benchmark tests for Python (local d
170170
##@ Tests
171171

172172
test-python-unit: ## Run Python unit tests (use pattern=<pattern> to filter tests, e.g., pattern=milvus, pattern=test_online_retrieval.py, pattern=test_online_retrieval.py::test_get_online_features_milvus)
173-
cd $(ROOT_DIR)/sdk/python && ([ -f .venv/bin/python ] && .venv/bin/python -m pytest -n 8 --color=yes $(if $(pattern),-k "$(pattern)") tests || python -m pytest -n 8 --color=yes $(if $(pattern),-k "$(pattern)") tests)
173+
cd $(ROOT_DIR) && uv run python -m pytest -n 8 --color=yes $(if $(pattern),-k "$(pattern)") sdk/python/tests
174174

175175
# Fast unit tests only
176176
test-python-unit-fast: ## Run fast unit tests only (no external dependencies)
177-
cd $(ROOT_DIR)/sdk/python && ([ -f .venv/bin/python ] && .venv/bin/python -m pytest tests/unit -n auto -x --tb=short || python -m pytest tests/unit -n auto -x --tb=short)
177+
cd $(ROOT_DIR) && uv run python -m pytest sdk/python/tests/unit -n auto -x --tb=short
178178

179179
# Changed files only (requires pytest-testmon)
180180
test-python-changed: ## Run tests for changed files only
181-
cd $(ROOT_DIR)/sdk/python && ([ -f .venv/bin/python ] && .venv/bin/python -m pytest --testmon -n 8 --tb=short tests || python -m pytest --testmon -n 8 --tb=short tests)
181+
cd $(ROOT_DIR) && uv run python -m pytest --testmon -n 8 --tb=short sdk/python/tests
182182

183183
# Quick smoke test for PRs
184184
test-python-smoke: ## Quick smoke test for development
185-
cd $(ROOT_DIR)/sdk/python && ([ -f .venv/bin/python ] && .venv/bin/python -m pytest \
186-
tests/unit/test_unit_feature_store.py \
187-
tests/unit/test_repo_operations_validate_feast_project_name.py \
188-
-n 4 --tb=short || python -m pytest \
189-
tests/unit/test_unit_feature_store.py \
190-
tests/unit/test_repo_operations_validate_feast_project_name.py \
191-
-n 4 --tb=short)
185+
cd $(ROOT_DIR) && uv run python -m pytest \
186+
sdk/python/tests/unit/test_unit_feature_store.py \
187+
sdk/python/tests/unit/test_repo_operations_validate_feast_project_name.py \
188+
-n 4 --tb=short
192189

193190
test-python-integration: ## Run Python integration tests (CI)
194-
cd $(ROOT_DIR)/sdk/python && ([ -f .venv/bin/python ] && .venv/bin/python -m pytest --tb=short -v -n 8 --integration --color=yes --durations=10 --timeout=1200 --timeout_method=thread --dist loadgroup \
191+
cd $(ROOT_DIR) && uv run python -m pytest --tb=short -v -n 8 --integration --color=yes --durations=10 --timeout=1200 --timeout_method=thread --dist loadgroup \
195192
-k "(not snowflake or not test_historical_features_main)" \
196193
-m "not rbac_remote_integration_test" \
197194
--log-cli-level=INFO -s \
198-
tests || python -m pytest --tb=short -v -n 8 --integration --color=yes --durations=10 --timeout=1200 --timeout_method=thread --dist loadgroup \
199-
-k "(not snowflake or not test_historical_features_main)" \
200-
-m "not rbac_remote_integration_test" \
201-
--log-cli-level=INFO -s \
202-
tests)
195+
sdk/python/tests
203196

204197
# Integration tests with better parallelization
205198
test-python-integration-parallel: ## Run integration tests with enhanced parallelization
206-
cd $(ROOT_DIR)/sdk/python && .venv/bin/python -m pytest tests/integration \
199+
cd $(ROOT_DIR) && uv run python -m pytest sdk/python/tests/integration \
207200
-n auto --dist loadscope \
208201
--timeout=300 --tb=short -v \
209202
--integration --color=yes --durations=20
@@ -214,25 +207,25 @@ test-python-integration-local: ## Run Python integration tests (local dev mode)
214207
HADOOP_HOME=$$HOME/hadoop \
215208
CLASSPATH="$$( $$HADOOP_HOME/bin/hadoop classpath --glob ):$$CLASSPATH" \
216209
HADOOP_USER_NAME=root \
217-
cd $(ROOT_DIR)/sdk/python && .venv/bin/python -m pytest --tb=short -v -n 8 --color=yes --integration --durations=10 --timeout=1200 --timeout_method=thread --dist loadgroup \
210+
cd $(ROOT_DIR) && uv run python -m pytest --tb=short -v -n 8 --color=yes --integration --durations=10 --timeout=1200 --timeout_method=thread --dist loadgroup \
218211
-k "not test_lambda_materialization and not test_snowflake_materialization" \
219212
-m "not rbac_remote_integration_test" \
220213
--log-cli-level=INFO -s \
221-
tests
214+
sdk/python/tests
222215

223216
test-python-integration-rbac-remote: ## Run Python remote RBAC integration tests
224217
FEAST_IS_LOCAL_TEST=True \
225218
FEAST_LOCAL_ONLINE_CONTAINER=True \
226-
cd $(ROOT_DIR)/sdk/python && .venv/bin/python -m pytest --tb=short -v -n 8 --color=yes --integration --durations=10 --timeout=1200 --timeout_method=thread --dist loadgroup \
219+
cd $(ROOT_DIR) && uv run python -m pytest --tb=short -v -n 8 --color=yes --integration --durations=10 --timeout=1200 --timeout_method=thread --dist loadgroup \
227220
-k "not test_lambda_materialization and not test_snowflake_materialization" \
228221
-m "rbac_remote_integration_test" \
229222
--log-cli-level=INFO -s \
230-
tests
223+
sdk/python/tests
231224

232225
test-python-integration-container: ## Run Python integration tests using Docker
233226
@(docker info > /dev/null 2>&1 && \
234227
FEAST_LOCAL_ONLINE_CONTAINER=True \
235-
cd $(ROOT_DIR)/sdk/python && .venv/bin/python -m pytest -n 8 --integration tests \
228+
cd $(ROOT_DIR) && uv run python -m pytest -n 8 --integration sdk/python/tests \
236229
) || echo "This script uses Docker, and it isn't running - please start the Docker Daemon and try again!";
237230

238231
test-python-universal-spark: ## Run Python Spark integration tests
@@ -604,7 +597,7 @@ test-python-universal-couchbase-online: ## Run Python Couchbase online store int
604597
sdk/python/tests
605598

606599
test-python-universal: ## Run all Python integration tests
607-
cd $(ROOT_DIR)/sdk/python && .venv/bin/python -m pytest -n 8 --integration tests
600+
cd $(ROOT_DIR) && uv run python -m pytest -n 8 --integration sdk/python/tests
608601

609602
##@ Java
610603

0 commit comments

Comments
 (0)