dongjoon-hyun opened a new pull request, #60730:
URL: https://github.com/apache/spark/pull/60730
### What changes were proposed in this pull request?
This PR aims to run the `List Python packages` and `Python linter` steps of
the `lint` job in PR builds only when the files that the Python linter checks,
or that configure it, change.
- The `precondition` job computes a new `lint-python` flag from the files
changed against `apache/spark`, in the same way as the existing `sparkr` flag.
The flag is `true` when any of the following files changes.
- Python sources and stubs: `*.py`, `*.pyi`
- `mypy` data tests: `*/tests/typing/*`
- `ruff` and `mypy` configurations: `pyproject.toml`, `python/mypy.ini`
- The linter script and the linter image: `dev/lint-python`,
`dev/spark-test-image/lint/*`
- This workflow file, which defines the Python linter steps
- The two steps run unless the flag is `false`. So the builds that pass
`jobs` without this key, i.e., the `apache/spark` push builds and the scheduled
builds, keep running them.
- The flag stays `true` when the list of changed files is empty.
### Why are the changes needed?
The `Python linter` step takes about 6 to 7 minutes (364s to 404s in the
recent PR builds) out of the 25 to 29 minutes of the `lint` job, even for PRs
that change no Python file, e.g. Scala or Java only PRs.
`dev/run-tests.py` already runs the Python style checks only when a `.py`,
`pyproject.toml`, or `lint-python` file changes. This PR applies the same idea
to GitHub Actions, and also covers the other inputs of `dev/lint-python` such
as `*.pyi` stubs, `python/mypy.ini`, and the `mypy` data tests.
### Does this PR introduce _any_ user-facing change?
No, this is a CI-only change.
### How was this patch tested?
Ran the `Check all modules` step script of the `precondition` job locally,
stubbing only `git diff --name-only`, and checked the `lint-python` value for
18 sets of changed files.
- `false`: Scala only, static UI resources only, docs and R only, `*.ipynb`
only, `py.typed` only
- `true`: `*.py` under `python/`, `dev/`, and `examples/`, `*.pyi`,
`tests/typing/*.yml` and `*.yaml`, `pyproject.toml`, `python/mypy.ini`,
`dev/lint-python`, the lint `Dockerfile`, this workflow file, Scala and Python
together, and an empty list
Note that the Python linter runs in this PR's CI because this PR changes
`.github/workflows/build_and_test.yml`.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Opus 5.5
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]