-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat: Modernize precommit hooks and optimize test performance #5929
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
Changes from 9 commits
e7c9113
031a978
a23152e
ae52fcc
88cefb3
759dd9e
ff4548e
de69e92
c8bbf87
46ed9d9
df45285
6bc12c2
eb6b346
5417ab2
6f6c736
9dae77f
63c8f3b
2068303
0da7c1d
8848a45
4904104
60466b2
97cd848
386c7cf
d8b156c
0b6d274
c530cf6
dec75eb
f50366b
282558a
f8051e1
0e111fc
12b4a72
2d54924
c69a5c8
cf72f4e
ad90593
3e827bc
9552822
9c499ad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,23 +1,23 @@ | ||
| default_stages: | ||
| - push | ||
| default_stages: [commit] | ||
|
|
||
| repos: | ||
| - repo: local | ||
| hooks: | ||
| - id: format | ||
| name: Format | ||
| stages: [ push ] | ||
| stages: [commit] | ||
| language: system | ||
| entry: make format-python | ||
| pass_filenames: false | ||
| - id: lint | ||
| name: Lint | ||
| stages: [ push ] | ||
| stages: [commit] | ||
| language: system | ||
| entry: make lint-python | ||
| pass_filenames: false | ||
| - id: template | ||
| name: Build Templates | ||
| stages: [ commit ] | ||
| stages: [commit] | ||
| language: system | ||
| entry: make build-templates | ||
| pass_filenames: false | ||
| pass_filenames: false | ||
|
franciscojavierarceo marked this conversation as resolved.
|
||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -55,14 +55,35 @@ protos: compile-protos-python compile-protos-docs ## Compile protobufs for Pytho | |||||||
| build: protos build-docker ## Build protobufs and Docker images | ||||||||
|
|
||||||||
| format-python: ## Format Python code | ||||||||
| cd ${ROOT_DIR}/sdk/python; python -m ruff check --fix feast/ tests/ | ||||||||
| cd ${ROOT_DIR}/sdk/python; python -m ruff format feast/ tests/ | ||||||||
| cd $(ROOT_DIR)/sdk/python && ([ -f .venv/bin/ruff ] && .venv/bin/ruff check --fix feast/ tests/ || ruff check --fix feast/ tests/) | ||||||||
| cd $(ROOT_DIR)/sdk/python && ([ -f .venv/bin/ruff ] && .venv/bin/ruff format feast/ tests/ || ruff format feast/ tests/) | ||||||||
|
|
||||||||
| lint-python: ## Lint Python code | ||||||||
| cd ${ROOT_DIR}/sdk/python; python -m mypy feast | ||||||||
| cd ${ROOT_DIR}/sdk/python; python -m ruff check feast/ tests/ | ||||||||
| cd ${ROOT_DIR}/sdk/python; python -m ruff format --check feast/ tests | ||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removing format check from CI?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nah i'll add that back. |
||||||||
|
|
||||||||
| cd $(ROOT_DIR)/sdk/python && ([ -f .venv/bin/ruff ] && .venv/bin/ruff check feast/ tests/ || ruff check feast/ tests/) | ||||||||
|
||||||||
| cd $(ROOT_DIR)/sdk/python && ([ -f .venv/bin/ruff ] && .venv/bin/ruff check feast/ tests/ || ruff check feast/ tests/) | |
| cd $(ROOT_DIR)/sdk/python && ([ -f .venv/bin/ruff ] && .venv/bin/ruff check feast/ tests/ || ruff check feast/ tests/) | |
| cd $(ROOT_DIR)/sdk/python && ([ -f .venv/bin/ruff ] && .venv/bin/ruff format --check feast/ tests/ || ruff format --check feast/ tests/) |
Copilot
AI
Feb 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setup-scripts only makes two of the newly-added helper scripts executable. If mypy-daemon.sh / perf-monitor.py are intended to be run directly, they should be included here as well (or this target should be removed in favor of committing executable bits in git).
| chmod +x scripts/uv-run.sh scripts/check-init-py.sh | |
| chmod +x scripts/uv-run.sh scripts/check-init-py.sh scripts/mypy-daemon.sh scripts/perf-monitor.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔴 test-python-integration-parallel target uses 300s timeout instead of 1200s like all other integration targets
The new test-python-integration-parallel Makefile target specifies --timeout=300 (5 minutes), while every other integration test target in the Makefile uses --timeout=1200 (20 minutes). Integration tests are inherently slower and frequently need more than 5 minutes per test. This will cause legitimate integration tests to be killed with timeout errors when run via this target.
Root Cause and Impact
All existing integration test targets consistently use --timeout=1200:
test-python-integrationatMakefile:157uses--timeout=1200test-python-integration-localatMakefile:169uses--timeout=1200test-python-integration-rbac-remoteatMakefile:179uses--timeout=1200
But the new target at Makefile:199-203 uses --timeout=300:
test-python-integration-parallel:
uv run python -m pytest sdk/python/tests/integration \
-n auto --dist loadscope \
--timeout=300 --tb=short -v \
--integration --color=yes --durations=20
The 300s value appears to have been copied from the new timeout = 300 setting in sdk/python/pytest.ini:21, which is intended as a default for unit tests. Integration tests need the longer 1200s timeout.
Impact: Integration tests running via this target will fail with timeout errors for any test taking over 5 minutes, which is common for integration tests that interact with external services.
| -n auto --dist loadscope \ | |
| --timeout=1200 --tb=short -v \ | |
Was this helpful? React with 👍 or 👎 to provide feedback.
Copilot
AI
Feb 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These targets hardcode .venv/bin/python without the fallback to python used by other test targets. That makes make test-python-integration-parallel fail for developers/CI environments that install deps into a different venv or use --system installs. Consider using the same conditional fallback pattern as test-python-unit/test-python-integration.
Copilot
AI
Feb 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This target now hardcodes .venv/bin/python (no fallback), but the docs commonly assume running tests from whatever Python environment is active (e.g. after pip install -e). Consider restoring the prior python -m pytest ... behavior or adding the same .venv/bin/python-or-python fallback used by test-python-unit.
Copilot
AI
Feb 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue as test-python-integration-local: this target hardcodes .venv/bin/python with no fallback, which will break when deps are installed into a different environment (or when using uv --system). Please add the same conditional fallback pattern used elsewhere.
Copilot
AI
Feb 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This docker-based test target now assumes .venv/bin/python exists. If a developer runs this after installing dependencies into an active venv or system env (no .venv), it will fail. Consider adding the .venv/bin/python-or-python fallback used by other pytest targets.
| cd $(ROOT_DIR)/sdk/python && .venv/bin/python -m pytest -n 8 --integration tests \ | |
| cd $(ROOT_DIR)/sdk/python && ([ -f .venv/bin/python ] && .venv/bin/python -m pytest -n 8 --integration tests || python -m pytest -n 8 --integration tests) \ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| #!/bin/bash | ||
| # Check for missing __init__.py files in Python packages | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| ROOT_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)" | ||
|
|
||
| # Find Python package directories missing __init__.py | ||
| missing_init_files=() | ||
|
|
||
| while IFS= read -r -d '' dir; do | ||
| # Skip .ipynb_checkpoints directories and other unwanted directories | ||
| if [[ "${dir}" == *".ipynb_checkpoints"* ]] || [[ "${dir}" == *"__pycache__"* ]]; then | ||
| continue | ||
| fi | ||
|
|
||
| if [[ ! -f "${dir}/__init__.py" ]] && [[ -n "$(find "${dir}" -maxdepth 1 -name "*.py" -print -quit)" ]]; then | ||
| missing_init_files+=("${dir}") | ||
| fi | ||
| done < <(find "${ROOT_DIR}/sdk/python/feast" -type d -print0) | ||
|
|
||
| if [[ ${#missing_init_files[@]} -gt 0 ]]; then | ||
| echo "❌ Missing __init__.py files in:" | ||
| printf " %s\n" "${missing_init_files[@]}" | ||
| echo "" | ||
| echo "Run: touch ${missing_init_files[*]/%//__init__.py}" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "✅ All Python packages have __init__.py files" |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,55 @@ | ||||||
| #!/bin/bash | ||||||
| # MyPy daemon for sub-second type checking | ||||||
|
|
||||||
| set -euo pipefail | ||||||
|
|
||||||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||||||
| ROOT_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)" | ||||||
|
|
||||||
| MYPY_CACHE_DIR="${ROOT_DIR}/sdk/python/.mypy_cache" | ||||||
| PID_FILE="$MYPY_CACHE_DIR/dmypy.pid" | ||||||
|
|
||||||
| case "$1" in | ||||||
|
franciscojavierarceo marked this conversation as resolved.
Outdated
|
||||||
| case "$1" in | |
| case "${1:-}" in |
Uh oh!
There was an error while loading. Please reload this page.