A collection of the Apache Spark stub files
Project description
A collection of the Apache Spark stub files. These files were generated by stubgen and manually edited to include accurate type hints.
Tests and configuration files have been originally contributed to the Typeshed project. Please refer to its contributors list and license for details.
Motivation
Static error detection (see SPARK-20631)
Improved autocompletion.
Installation and usage
Please note that the guidelines for distribution of type information is still work in progress (PEP 561 - Distributing and Packaging Type Information). Currently installation script overlays existing Spark installations (pyi stub files are copied next to their py counterparts in the PySpark installation directory). If this approach is not acceptable you can add stub files to the search path manually.
According to PEP 484:
Third-party stub packages can use any location for stub storage. Type checkers should search for them using PYTHONPATH.
Moreover:
Third-party stub packages can use any location for stub storage. Type checkers should search for them using PYTHONPATH. A default fallback directory that is always checked is shared/typehints/python3.5/ (or 3.6, etc.)
Please check usage before proceeding.
The package is available on PYPI:
pip install pyspark-stubs
and conda-forge:
conda install -c conda-forge pyspark-stubs
Depending on your environment you might also need a type checker, like Mypy or Pytype [1], and autocompletion tool, like Jedi.
Editor |
Type checking |
Autocompletion |
Notes |
---|---|---|---|
✔ [2] |
✔ [3] |
Through plugins. |
|
✘ [4] |
✔ |
||
✔ |
✔ |
||
✔ [5] |
? |
||
✔ [6] |
✔ [7] |
Through plugins. |
|
✔ [8] |
✔ [9] |
Completion with plugin |
|
Environment independent / other editors |
✔ [10] |
✔ [11] |
This package is tested against MyPy development branch and in rare cases (primarily important upstrean bugfixes), is not compatible with the preceding MyPy release.
PySpark Version Compatibility
Package versions follow PySpark versions with exception to maintenance releases - i.e. pyspark-stubs==2.3.0 should be compatible with pyspark>=2.3.0,<2.4.0. Maintenance releases (post1, post2, …, postN) are reserved for internal annotations updates.
API Coverage:
As of release 2.4.0 most of the public API is covered. For details please check API coverage document.
See also
SPARK-17333 - Make pyspark interface friendly with static analysis.
PySpark typing hints and Revisiting PySpark type annotations on Apache Spark Developers List.
Disclaimer
Apache Spark, Spark, PySpark, Apache, and the Spark logo are trademarks of The Apache Software Foundation. This project is not owned, endorsed, or sponsored by The Apache Software Foundation.
Footnotes
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pyspark_stubs-3.0.0.dev7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3e928051a358a9d3d32962a19ce8d7a30dc28a506be999a98e77f30deace17c |
|
MD5 | 1afe29e212f72fe756aea2d7ffa6a88a |
|
BLAKE2b-256 | 1fbbbe68b6bc19f3598b2ca7688630a36d49134d48599b1569a4348338287819 |