chore(spark): replace pyspark-connect with pyspark-client (#781) #795
🎉 Welcome to the Kubeflow SDK! 🎉
Thanks for opening your first PR! We're happy to have you as part of our community 🚀
Here's what happens next:
Join the community:
Feel free to ask questions in the comments if you need any help or clarification!
Thanks again for contributing to Kubeflow! 🙏
/ok-to-test
/retest
Hi @Neha-Nimsatkar thanks for this PR. Can you add a short CHANGELOG entry for the next release covering: [spark] now installs pyspark-client, remote-only via sc://, and full PySpark/Py4J/JARs no longer installed.
Optionally mention the 4.2.0 → 4.0.4 alignment in the PR description, it’s a meaningful improvement worth calling out.
Overall this looks good to me from a functionality and safety perspective. Nice work on #781!
cc: @tariq-hasan @Shekharrajak
@RobuRishabh Thanks for the review!
CHANGELOG/CHANGELOG-0.5.md covering the pyspark-client migration, remote-only sc:// requirements, and removal of bundled JARs/Py4J.
4.2.0 → 4.0.4 version alignment with the Spark operator image.
All pre-commit checks and DCO sign-offs are in place. Ready for your final look!
Approved these changes.
/lgtm
/approve
/assign @astefanutti
We should remove the changelog. It’s auto-generated as part of cliff.toml.
We should remove the changelog. It’s auto-generated as part of cliff.toml.
Thanks @tariq-hasan , I have Reverted the changelog file and squashed down to a single clean commit .
/lgtm
Hi @andreyvelich @astefanutti @kramaranya @Electronic-Waste this PR has a direct security impact worth prioritizing.
The current pyspark-connect dependency pulls in the full pyspark package (324 bundled JARs) including CVE-prone Java libraries (Jackson, Netty, Log4j components, Hadoop, etc.) that the SDK never uses, it only talks to Spark Connect servers over gRPC. Vulnerability scanners flag these JARs, creating noise and blocking deployments for teams with compliance gates. Switching to pyspark-client drops these JARs, removes py4j and zstandard, fixes the 4.2.0→4.0.4 version skew, and all CI checks (including E2E) are green. It's a drop-in replacement with no API changes.
Could we get /approve when you get a chance? Thanks!
/lgtm
/approve
@astefanutti for merge.
Thanks for this work everyone!
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: <a href="https://github.com/kubeflow/sdk/pull/795#pullrequestreview-5394626433" title="Approved">andreyvelich</a>, <a href="https://github.com/kubeflow/sdk/pull/795#issuecomment-5945160689" title="Approved">Shekharrajak</a>
The full list of commands accepted by this bot can be found here.
The pull request process is described here
<details >
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
</details>
<!-- META={"approvers":[]} -->
RobuRishabh
Neha-Nimsatkar
<!-- Thanks for sending a pull request! Here are some tips for you:
1. If this is your first time, check our contributor guidelines: https://www.kubeflow.org/docs/about/contributing
2. To know more about Kubeflow SDK, check the developer guide:
https://github.com/kubeflow/sdk/blob/main/CONTRIBUTING.md
3. If you want faster PR reviews, check how: https://git.k8s.io/community/contributors/guide/pull-requests.md#best-practices-for-faster-reviews
-->
What this PR does / why we need it:
Replaces the heavy
pyspark-connectdependency withpyspark-clientto remove unnecessary JVM/JAR runtime dependencies from the client environment while maintaining remote Spark Connect functionality (sc://).Audit & Investigation Findings:
.jarcount in.venvfrom 324 down to 0 (find .venv -name '.jar' | wc -lreturned 0).pyspark==4.2.0andpy4j==0.10.9.9.pyspark-clientto version4.0.4(matchingDEFAULT_SPARK_VERSIONandapache/spark:4.0.4), eliminating client/server protocol skew and preventing unintended runtime drift from floating4.2.0.from pyspark.sql import SparkSessionimports cleanly without JVM dependencies.Local Verification:
make verify(linting, formatting, and type checks passed)make test-python(695/695 unit tests passed)test_spark_connect_crd_smokepassedCHANGELOG/CHANGELOG-0.5.mdcoveringpyspark-clientmigration,sc://remote requirement, and JAR/Py4J removal.Which issue(s) this PR fixes (optional, in
Fixes #<issue number>, #<issue number>, ...format, will close the issue(s) when PR gets merged)*:Fixes #781
Checklist: