Skip to content

Commit 82ae109

Browse files
franciscojavierarceoclaude
authored andcommitted
feat: Improve local dev experience with file-aware hooks and auto parallelization
- Make precommit hooks file-aware: format and lint only changed Python files - Add conditional template hook that only runs when template files change - Update test-python-integration-local to use -n auto and --dist loadscope - Add new pytest markers: slow, cloud, local_only for better test selection - Add format-python-files and lint-python-files Makefile targets Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent e2bad34 commit 82ae109

File tree

3 files changed

+38
-9
lines changed

3 files changed

+38
-9
lines changed

.pre-commit-config.yaml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,29 @@ default_stages: [commit]
33
repos:
44
- repo: local
55
hooks:
6-
- id: format
7-
name: Format
6+
# File-aware format hook - only runs on changed Python files
7+
- id: format-files
8+
name: Format Changed Files
89
stages: [commit]
910
language: system
10-
entry: make format-python
11-
pass_filenames: false
12-
- id: lint
13-
name: Lint
11+
types: [python]
12+
entry: uv run ruff check --fix
13+
pass_filenames: true
14+
15+
# File-aware lint hook - only runs on changed Python files
16+
- id: lint-files
17+
name: Lint Changed Files
1418
stages: [commit]
1519
language: system
16-
entry: make lint-python
17-
pass_filenames: false
20+
types: [python]
21+
entry: uv run ruff check
22+
pass_filenames: true
23+
24+
# Conditional template hook - only runs when template files change
1825
- id: template
1926
name: Build Templates
2027
stages: [commit]
2128
language: system
29+
files: ^infra/templates/|\.jinja2$
2230
entry: make build-templates
2331
pass_filenames: false

Makefile

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,29 @@ format-python: ## Format Python code
5858
uv run ruff check --fix sdk/python/feast/ sdk/python/tests/
5959
uv run ruff format sdk/python/feast/ sdk/python/tests/
6060

61+
# File-aware format (for use with pre-commit, accepts file args)
62+
format-python-files: ## Format specified Python files
63+
@if [ -n "$(FILES)" ]; then \
64+
uv run ruff check --fix $(FILES); \
65+
uv run ruff format $(FILES); \
66+
else \
67+
echo "Usage: make format-python-files FILES='file1.py file2.py'"; \
68+
fi
69+
6170
lint-python: ## Lint Python code
6271
uv run ruff check sdk/python/feast/ sdk/python/tests/
6372
uv run ruff format --check sdk/python/feast/ sdk/python/tests/
6473
uv run bash -c "cd sdk/python && mypy feast"
6574

75+
# File-aware lint (for use with pre-commit, accepts file args)
76+
lint-python-files: ## Lint specified Python files
77+
@if [ -n "$(FILES)" ]; then \
78+
uv run ruff check $(FILES); \
79+
uv run ruff format --check $(FILES); \
80+
else \
81+
echo "Usage: make lint-python-files FILES='file1.py file2.py'"; \
82+
fi
83+
6684
# New combined target
6785
precommit-check: format-python lint-python ## Run all precommit checks
6886
@echo "✅ All precommit checks passed"
@@ -209,7 +227,7 @@ test-python-integration-local: ## Run Python integration tests (local dev mode)
209227
HADOOP_HOME=$$HOME/hadoop \
210228
CLASSPATH="$$( $$HADOOP_HOME/bin/hadoop classpath --glob ):$$CLASSPATH" \
211229
HADOOP_USER_NAME=root \
212-
uv run python -m pytest --tb=short -v -n 8 --color=yes --integration --durations=10 --timeout=1200 --timeout_method=thread --dist loadgroup \
230+
uv run python -m pytest --tb=short -v -n auto --color=yes --integration --durations=10 --timeout=1200 --timeout_method=thread --dist loadscope \
213231
-k "not test_lambda_materialization and not test_snowflake_materialization" \
214232
-m "not rbac_remote_integration_test" \
215233
--log-cli-level=INFO -s \

sdk/python/pytest.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ markers =
1717
rbac_remote_integration_test: RBAC and remote functionality tests
1818
integration: Integration tests (slower, requires services)
1919
benchmark: Benchmark tests
20+
slow: Tests taking >30 seconds
21+
cloud: Tests requiring cloud credentials
22+
local_only: Tests that run entirely locally
2023

2124
timeout = 300
2225
timeout_method = thread

0 commit comments

Comments
 (0)