Skip to content

[SPARK-46107][PYTHON][ML] Deprecate pyspark.keyword_only API - #44023

Closed
HyukjinKwon wants to merge 7 commits into
apache:masterfrom
HyukjinKwon:SPARK-46107
Closed

[SPARK-46107][PYTHON][ML] Deprecate pyspark.keyword_only API#44023
HyukjinKwon wants to merge 7 commits into
apache:masterfrom
HyukjinKwon:SPARK-46107

Conversation

@HyukjinKwon

Copy link
Copy Markdown
Member

What changes were proposed in this pull request?

This PR deprecates pyspark.keyword_only API, remove the usage in our codebase.

Note that this PR also removes the docstring that is used for substituting the signature (autodoc_docstring_signature feature) in user-facing API documentation. We use keyword-only arguments after SPARK-32933 so we do not need to substitute them anymore, see also sphinx-doc/sphinx#5142.

Why are the changes needed?

Initially pyspark.keyword_only was added to maintain the Python compatibility between Python 2 and Python 3 (see PEP-3102). Those Python 2-style arguments were removed in SPARK-32933 so we do not need this decorator anymore.

Does this PR introduce any user-facing change?

Yes, it deprecates pyspark.keyword_only.

How was this patch tested?

Manually checked the documentation build, and linter. Existing test cases should validate them.

Was this patch authored or co-authored using generative AI tooling?

No.

@HyukjinKwon

HyukjinKwon commented Nov 27, 2023

Copy link
Copy Markdown
Member Author

cc @mengxr @WeichenXu123 @zhengruifeng FYI

@github-actions github-actions Bot added the DOCS label Nov 27, 2023
Comment thread python/pyspark/ml/classification.py
@HyukjinKwon

Copy link
Copy Markdown
Member Author

cc @zero323 too

weightCol: Optional[str] = None,
) -> "GaussianMixture":
"""
setParams(self, \\*, featuresCol="features", predictionCol="prediction", k=2, \

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Screenshot 2023-11-27 at 5 05 53 PM

__init__(self, \\*, featuresCol="features", predictionCol="prediction", k=2, \
probabilityCol="probability", tol=0.01, maxIter=100, seed=None, \
aggregationDepth=2, weightCol=None)
"""

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Manually checked:
Screenshot 2023-11-27 at 5 05 57 PM

@HyukjinKwon

Copy link
Copy Markdown
Member Author

Alrigjt, I don't think I can make this working without the decorator because the fact that the argument is given matters (vs default, see also cb43bbe). I am dropping this PR.

@HyukjinKwon
HyukjinKwon deleted the SPARK-46107 branch January 15, 2024 00:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants