Skip to content

chore(spark): replace pyspark-connect with pyspark-client (#781) - #795

Merged
google-oss-prow[bot] merged 1 commit into
kubeflow:mainfrom
Neha-Nimsatkar:chore/replace-pyspark-connect-781
Oct 2, 2026
Merged

google-oss-prow[bot] merged 1 commit into
kubeflow:mainfrom
Neha-Nimsatkar:chore/replace-pyspark-connect-781

Conversation

@Neha-Nimsatkar

@Neha-Nimsatkar Neha-Nimsatkar commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:
Replaces the heavy pyspark-connect dependency with pyspark-client to remove unnecessary JVM/JAR runtime dependencies from the client environment while maintaining remote Spark Connect functionality (sc://).

Audit & Investigation Findings:

  • JAR Count Reduction: Reduced .jar count in .venv from 324 down to 0 (find .venv -name '*.jar' | wc -l returned 0).
  • Dependencies Removed: Stripped transitive JVM runtime dependencies pyspark==4.2.0 and py4j==0.10.9.9.
  • Spark Version Alignment (4.2.0 → 4.0.4): Aligned pyspark-client to version 4.0.4 (matching DEFAULT_SPARK_VERSION and apache/spark:4.0.4), eliminating client/server protocol skew and preventing unintended runtime drift from floating 4.2.0.
  • Import Check: Verified from pyspark.sql import SparkSession imports 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_smoke passed
  • Added entry to CHANGELOG/CHANGELOG-0.5.md covering pyspark-client migration, 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:

  • Docs included if any changes are user facing

@github-actions

Copy link
Copy Markdown
Contributor

🎉 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:

  • If you haven't already, please check out our Contributing Guide for repo-specific guidelines and the Kubeflow Contributor Guide for general community standards
  • Our team will review your PR soon! cc @kubeflow/kubeflow-sdk-team

Join the community:

Feel free to ask questions in the comments if you need any help or clarification!
Thanks again for contributing to Kubeflow! 🙏

@tariq-hasan

Copy link
Copy Markdown
Member

/ok-to-test
/retest

@RobuRishabh

Copy link
Copy Markdown

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

@Neha-Nimsatkar
Neha-Nimsatkar force-pushed the chore/replace-pyspark-connect-781 branch 2 times, most recently from e278360 to b3ac44c Compare September 12, 2026 08:22
@Neha-Nimsatkar

Copy link
Copy Markdown
Contributor Author

@RobuRishabh Thanks for the review!

  • Added the CHANGELOG entry under CHANGELOG/CHANGELOG-0.5.md covering the pyspark-client migration, remote-only sc:// requirements, and removal of bundled JARs/Py4J.
  • Updated the PR description to call out the 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!

@Shekharrajak

Copy link
Copy Markdown
Member

/lgtm
/approve

@Shekharrajak

Copy link
Copy Markdown
Member

/assign @astefanutti

@RobuRishabh RobuRishabh moved this to Needs Triage in Kubeflow SDK Sep 21, 2026
@tariq-hasan tariq-hasan moved this from Needs Triage to Ready to Merge in Kubeflow SDK Sep 21, 2026
@tariq-hasan

Copy link
Copy Markdown
Member

We should remove the changelog. It’s auto-generated as part of cliff.toml.

Signed-off-by: Neha-Nimsatkar <1492neha@gmail.com>
@Neha-Nimsatkar
Neha-Nimsatkar force-pushed the chore/replace-pyspark-connect-781 branch from b3ac44c to d18046b Compare September 28, 2026 06:23
@google-oss-prow google-oss-prow Bot removed the lgtm label Sep 28, 2026
@Neha-Nimsatkar

Copy link
Copy Markdown
Contributor Author

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 .

@RobuRishabh

Copy link
Copy Markdown

/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!

@google-oss-prow google-oss-prow Bot added the lgtm label Oct 2, 2026
@Shekharrajak

Copy link
Copy Markdown
Member

/lgtm
/approve

@Shekharrajak

Copy link
Copy Markdown
Member

@astefanutti for merge.

@andreyvelich andreyvelich left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this work everyone!
/lgtm
/approve

@google-oss-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andreyvelich, Shekharrajak

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

@google-oss-prow
google-oss-prow Bot merged commit 28bdf01 into kubeflow:main Oct 2, 2026
19 checks passed
@google-oss-prow google-oss-prow Bot added this to the v0.5 milestone Oct 2, 2026
digvijay-y pushed a commit to digvijay-y/sdk that referenced this pull request Oct 17, 2026
…) (kubeflow#795)

Signed-off-by: Neha-Nimsatkar <1492neha@gmail.com>
Signed-off-by: digvijay-y <144053736+digvijay-y@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Evaluate replacing pyspark-connect with pyspark-client in [spark] extra

6 participants