skillfed

pyspark-stubs

A collection of the Apache Spark stub files

pyspark-stubs v3.0.0.post3 117.6K downloads/30d#12,156 on PyPI118
Permissive license Abandoned released

What it is and what it does

PySpark Stubs is a collection of type stub files (.pyi) for Apache Spark's Python API, generated by mypy's stubgen tool and manually refined with accurate type hints. It allows developers to use static type checkers like mypy and IDEs like PyCharm to catch type errors in PySpark code before runtime, and enables better autocompletion in editors.

The package was originally maintained as a standalone project but has been merged into the main Apache Spark repository for versions 3.1 and later. This PyPI package continues to serve Spark 2.4 and 3.0 users, though it is no longer actively developed. Installation overlays the stub files into your PySpark installation directory so type checkers can find them automatically.

Use it for:

  • Catch type errors in PySpark code during development using mypy or similar type checkers before submitting to production.
  • Improve IDE autocompletion and inline documentation in PyCharm, VS Code, or other editors that support type hints.
  • Enable static analysis in CI/CD pipelines to enforce type safety on Spark data processing jobs.
  • Support legacy Spark 2.4 or 3.0 projects that need type hints but cannot upgrade to newer Spark versions with built-in stubs.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides type stubs for PySpark to enable static type checking and improved IDE autocompletion when working with Apache Spark in Python.

Yes, if you are using Spark 2.4 or 3.0 and want type checking support—but be aware the package is abandoned and no longer receives updates. For Spark 3.1+, use the type hints built into Apache Spark itself instead. The stubs are permissively licensed and install easily, but verify compatibility with your current mypy and PySpark versions before relying on them in production.

Install

pyspark-stubs on PyPI

pip

pip install pyspark-stubs

uv

uv add pyspark-stubs

poetry

poetry add pyspark-stubs

Installing pyspark-stubs

Before you install

Installation is straightforward with low friction, but the package is abandoned as of August 2022 and no longer maintained. Development was merged into Apache Spark 3.1+; this package only receives fixes for Spark 2.4 and 3.0 until their deprecation.

License in practice

Licensed under the permissive Apache License, which allows use in commercial and private projects with minimal restrictions.

Quickstart

pip install pyspark-stubs

# Type checker (e.g., mypy) will then recognize PySpark types
import pyspark
from pyspark.sql import SparkSession

Requires a type checker (mypy, pytype, or equivalent) to be installed separately to use the stubs; stubs alone do not enforce types at runtime.

Verify before relying

  • Whether stub coverage remains adequate for modern PySpark workflows given the package is unmaintained since 2022.
  • Compatibility with PySpark versions released after January 2022 (the latest release date).
  • Whether the stubs work correctly with current versions of mypy or other type checkers, as the description notes rare incompatibilities with preceding mypy releases.

Package facts

License not declared (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 1 — pyspark
Maintenance abandoned — 1,682 days since the last release
Last repo commit (repository archived)
First released
Downloads 117,589/month — #12,156 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pyspark_stubs-3.0.0.post3-py3-none-any.whl

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTyping :: Typed

Tags

pyspark type hintsspark static type checkingpyspark stub filesmypy pyspark supportspark ide autocompletionpyspark type annotationsspark python typing
type-checkingstatic-analysisspark

More Quality Assurance packages