---
title: Pulsar Stubs
---

[![PyPI
version](https://img.shields.io/pypi/v/pulsar-stubs.svg)](https://pypi.org/project/pulsar-stubs/)
[![Conda Forge
version](https://img.shields.io/conda/vn/conda-forge/pulsar-stubs.svg)](https://anaconda.org/conda-forge/pulsar-stubs)

A collection of the Apache Spark [stub
files](https://www.python.org/dev/peps/pep-0484/#stub-files). These
files were generated by
[stubgen](https://github.com/python/mypy/blob/master/mypy/stubgen.py)
and manually edited to include accurate type hints.

Tests and configuration files have been originally contributed to the
[Typeshed project](https://github.com/python/typeshed/). Please refer to
its [contributors
list](https://github.com/python/typeshed/graphs/contributors) and
[license](https://github.com/python/typeshed/blob/master/LICENSE) for
details.

# Motivation

- 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](https://www.python.org/dev/peps/pep-0561/)). Currently
installation script overlays existing Spark installations (`pyi` stub
files are copied next to their `py` counterparts in the Pulsar
installation directory). If this approach is not acceptable you can add
stub files to the search path manually.

According to [PEP
484](https://www.python.org/dev/peps/pep-0484/#storing-and-distributing-stub-files):

> 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](https://pypi.org/project/pulsar-stubs/):

``` bash
pip install pulsar-stubs
```

and [conda-forge](https://anaconda.org/conda-forge/pulsar-stubs):

``` bash
conda install -c conda-forge pulsar-stubs
```

Depending on your environment you might also need a type checker, like
[Mypy](http://mypy-lang.org/) or
[Pytype](https://github.com/google/pytype)[^1], and autocompletion tool,
like [Jedi](https://github.com/davidhalter/jedi).



This package is tested against MyPy development branch and in rare cases
(primarily important upstream bugfixes), is not compatible with the
preceding MyPy release.

# Pulsar Version Compatibility

Package versions follow Pulsar versions with exception to maintenance
releases - i.e. [pulsar-stubs==2.0.2] should be compatible
with [Pulsar\>=2.0.2,\<2.1.0]. Maintenance releases
([post1], [post2], \..., [postN])
are reserved for internal annotations updates.

# API Coverage:

The package is generated from the [Pulsar](https://pypi.org/project/pulsar-client/) codebase and is not
guaranteed to be complete. The goal is to provide type hints for the
most commonly used classes and methods. The package is not intended to
be a complete replacement for the original codebase.

# Disclaimer

Apache Pulsar, Pulsar, Apache, and the Pulsar logo are
[trademarks](https://www.apache.org/foundation/marks/) of [The Apache
Software Foundation](http://www.apache.org/). This project is not owned,
endorsed, or sponsored by The Apache Software Foundation.

# Footnotes

[^1]: Not supported or tested.
