Hyukjin Kwon created SPARK-61854:
------------------------------------

             Summary: Add the type stubs of PySpark 4.3.0's API for the 
Rust-backed and generated modules, so that mypy and pyright see it
                 Key: SPARK-61854
                 URL: https://issues.apache.org/jira/browse/SPARK-61854
             Project: Spark
          Issue Type: Improvement
          Components: Connect
    Affects Versions: connect-rust-4.4.0
            Reporter: Hyukjin Kwon


Static type checkers cannot see PySpark's API on the Python drop-in. mypy 
cannot see 518 of the 552 functions of pyspark.sql.functions.__all__ 
(functions.py loads functions_generated.py through importlib and injects the 
functions with globals()), and the methods of the DataFrame, the readers and 
the other Rust-backed classes resolve to Any, as pyspark._pyspark has no stubs. 
So valid code gets attr-defined errors ("Module has no attribute 'desc'"), and 
type errors go uncaught; on official pyspark-client 4.3.0, mypy reports only 
the real errors.

Generate type stubs (.pyi) of the Rust-backed and dynamic modules from PySpark 
v4.3.0's annotated sources, with a drift check and a test that runs mypy on a 
user's application.




--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to