Explain adding new third-party stubs (#5951)

Closes: #5438
This commit is contained in:
Sebastian Rittau
2021-08-24 05:47:54 +02:00
committed by GitHub
parent db0f37ccdf
commit 9b366daaec

View File

@@ -54,7 +54,12 @@ Modules that are only available for Python 2 are not listed in `VERSIONS`.
### Third-party library stubs
Modules that are not shipped with Python but have a type description in Python
We accept stubs for third-party packages into typeshed as long as:
* the package is publicly available on the [Python Package Index](https://pypi.org/);
* the package supports any Python version supported by typeshed; and
* the package does not ship with its own stubs or type annotations.
Stubs for third-party packages
go into `stubs`. Each subdirectory there represents a PyPI distribution, and
contains the following:
* `METADATA.toml`, describing the package. See below for details.
@@ -66,7 +71,12 @@ contains the following:
and also with Python 2 if `python2 = true` is set in `METADATA.toml` (see below).
* (Rarely) some docs specific to a given type stub package in `README` file.
When a third party stub is
The fastest way to generate new stubs is to use [stubgen](https://mypy.readthedocs.io/en/stable/stubgen.html),
a tool shipped with mypy. Please make sure to use the latest version.
The generated stubs usually need some trimming of imports. You also need
to run `black` and `isort` manually on the generated stubs (see below).
When a third party stub is added or
modified, an updated version of the corresponding distribution will be
automatically uploaded to PyPI within a few hours.
Each time this happens the least significant