Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 1 addition & 27 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -342,37 +342,11 @@ always put the code for the most recent Python version first.

### Incomplete stubs

We accept partial stubs, especially for larger packages. These need to
follow the following guidelines:
We generally prefer complete stubs, but for larger packages can be submitted with some incomplete non-essential parts.The thing to be remembered is:

* Included functions and methods must list all arguments, but the arguments
can be left unannotated. Do not use `Any` to mark unannotated arguments
or return values.
* Partial classes must include a `__getattr__()` method marked with an
`# incomplete` comment (see example below).
* Partial modules (i.e. modules that are missing some or all classes,
functions, or attributes) must include a top-level `__getattr__()`
function marked with an `Incomplete` return type (see example below).
* Partial packages (i.e. packages that are missing one or more sub-modules)
must have a `__init__.pyi` stub that is marked as incomplete (see above).
A better alternative is to create empty stubs for all sub-modules and
mark them as incomplete individually.

Example of a partial module with a partial class `Foo` and a partially
annotated function `bar()`:

```python
from _typeshed import Incomplete

class Foo:
def __getattr__(self, name: str) -> Incomplete: ...
x: int
y: str

def bar(x: str, y, *, z=...): ...

def __getattr__(name: str) -> Incomplete: ...
```

## Stub file coding style

Expand Down