You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by ze...@apache.org on 2022/09/07 09:30:28 UTC

[spark] branch master updated: [SPARK-40273][PYTHON][DOCS] Fix the documents "Contributing and Maintaining Type Hints"

This is an automated email from the ASF dual-hosted git repository.

zero323 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new e6c58c1bd6f [SPARK-40273][PYTHON][DOCS] Fix the documents "Contributing and Maintaining Type Hints"
e6c58c1bd6f is described below

commit e6c58c1bd6f64ebfb337348fa6132c0b230dc932
Author: itholic <ha...@databricks.com>
AuthorDate: Wed Sep 7 11:29:45 2022 +0200

    [SPARK-40273][PYTHON][DOCS] Fix the documents "Contributing and Maintaining Type Hints"
    
    ### What changes were proposed in this pull request?
    
    This PR proposes to fix the [Contributing and Maintaining Type Hints](https://spark.apache.org/docs/latest/api/python/development/contributing.html#contributing-and-maintaining-type-hints) since the existing type hints in the stub files are all ported into inline type hints.
    
    ### Why are the changes needed?
    
    We no longer use the stub files for type hinting, so we might need to change the documents as well.
    
    ### Does this PR introduce _any_ user-facing change?
    
    Yes, the documentation change.
    
    ### How was this patch tested?
    
    The existing documentation build should pass
    
    Closes #37724 from itholic/SPARK-40273.
    
    Authored-by: itholic <ha...@databricks.com>
    Signed-off-by: zero323 <ms...@gmail.com>
---
 python/docs/source/development/contributing.rst | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/python/docs/source/development/contributing.rst b/python/docs/source/development/contributing.rst
index 9780d6eca4e..3d388e91012 100644
--- a/python/docs/source/development/contributing.rst
+++ b/python/docs/source/development/contributing.rst
@@ -155,10 +155,7 @@ Now, you can start developing and `running the tests <testing.rst>`_.
 Contributing and Maintaining Type Hints
 ----------------------------------------
 
-PySpark type hints are provided using stub files, placed in the same directory as the annotated module, with exception to:
-
-* ``# type: ignore`` in modules which don't have their own stubs (tests, examples and non-public API). 
-* pandas API on Spark (``pyspark.pandas`` package) where the type hints are inlined.
+PySpark type hints are inlined, to take advantage of static type checking.
 
 As a rule of thumb, only public API is annotated.
 
@@ -166,7 +163,7 @@ Annotations should, when possible:
 
 * Reflect expectations of the underlying JVM API, to help avoid type related failures outside Python interpreter.
 * In case of conflict between too broad (``Any``) and too narrow argument annotations, prefer the latter as one, as long as it is covering most of the typical use cases.
-* Indicate nonsensical combinations of arguments using ``@overload``  annotations. For example, to indicate that ``*Col`` and ``*Cols`` arguments are mutually exclusive:
+* Indicate nonsensical combinations of arguments using ``@overload`` annotations. For example, to indicate that ``*Col`` and ``*Cols`` arguments are mutually exclusive:
 
   .. code-block:: python
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org