diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index af07798bf1f..5d7a63c7f57 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,21 +3,31 @@ default_stages: [commit] repos: - repo: local hooks: - - id: format - name: Format + # File-aware format hook - only runs on changed Python files + # Runs both ruff check --fix and ruff format + - id: format-files + name: Format Changed Files stages: [commit] language: system - entry: make format-python - pass_filenames: false - - id: lint - name: Lint + types: [python] + entry: bash -c 'uv run ruff check --fix "$@" && uv run ruff format "$@"' -- + pass_filenames: true + + # File-aware lint hook - only runs on changed Python files + # Runs both ruff check and ruff format --check + - id: lint-files + name: Lint Changed Files stages: [commit] language: system - entry: make lint-python - pass_filenames: false + types: [python] + entry: bash -c 'uv run ruff check "$@" && uv run ruff format --check "$@"' -- + pass_filenames: true + + # Conditional template hook - only runs when template files or roadmap change - id: template name: Build Templates stages: [commit] language: system + files: ^infra/templates/|\.jinja2$|^docs/roadmap\.md$ entry: make build-templates pass_filenames: false diff --git a/Makefile b/Makefile index 2ae9a07a246..3360e88f6a2 100644 --- a/Makefile +++ b/Makefile @@ -199,7 +199,7 @@ test-python-integration: ## Run Python integration tests (CI) # Integration tests with better parallelization test-python-integration-parallel: ## Run integration tests with enhanced parallelization uv run python -m pytest sdk/python/tests/integration \ - -n auto --dist loadscope \ + -n auto --dist loadgroup \ --timeout=300 --tb=short -v \ --integration --color=yes --durations=20 @@ -209,7 +209,7 @@ test-python-integration-local: ## Run Python integration tests (local dev mode) HADOOP_HOME=$$HOME/hadoop \ CLASSPATH="$$( $$HADOOP_HOME/bin/hadoop classpath --glob ):$$CLASSPATH" \ HADOOP_USER_NAME=root \ - uv run python -m pytest --tb=short -v -n 8 --color=yes --integration --durations=10 --timeout=1200 --timeout_method=thread --dist loadgroup \ + uv run python -m pytest --tb=short -v -n auto --color=yes --integration --durations=10 --timeout=1200 --timeout_method=thread --dist loadgroup \ -k "not test_lambda_materialization and not test_snowflake_materialization" \ -m "not rbac_remote_integration_test" \ --log-cli-level=INFO -s \ diff --git a/sdk/python/pytest.ini b/sdk/python/pytest.ini index 3182cd991f6..31640e509d7 100644 --- a/sdk/python/pytest.ini +++ b/sdk/python/pytest.ini @@ -17,6 +17,9 @@ markers = rbac_remote_integration_test: RBAC and remote functionality tests integration: Integration tests (slower, requires services) benchmark: Benchmark tests + slow: Tests taking >30 seconds + cloud: Tests requiring cloud credentials + local_only: Tests that run entirely locally timeout = 300 timeout_method = thread