Skip to content

Commit 58fdb3d

Browse files
authored
Add a policy for using @deprecated (#16071)
1 parent faaa858 commit 58fdb3d

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

CONTRIBUTING.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,25 @@ documentation. Whenever you find them disagreeing, model the type
320320
information after the actual implementation and file an issue on the
321321
project's tracker to fix their documentation.
322322

323+
### Deprecations (using the `@deprecated` decorator)
324+
325+
Generally deprecactions using the `@deprecated` decorator are added more
326+
liberally in typeshed than runtime deprecation warnings. Here are some
327+
guidelines that can be deviated from in special cases.
328+
329+
Use `@deprecated` if and only if
330+
331+
- a feature is deprecated at runtime (either using `@deprecated` or with a
332+
runtime warning); or
333+
- a feature is documented to be deprecated (e.g. in API documention,
334+
docstrings, or comments).
335+
336+
For standard library features that are not deprecated in all Python versions
337+
currently supported by typeshed use `@deprecated` for
338+
339+
- all versions starting with the "Deprecated since" version, plus
340+
- all versions for which an alternative is available.
341+
323342
### Docstrings
324343

325344
Typeshed stubs should not include duplicated docstrings from the source code.

0 commit comments

Comments
 (0)