-
Notifications
You must be signed in to change notification settings - Fork 23
Closed
Labels
Description
Typeshed currently has a script that checks a bunch of things that belong here IMO: https://github.com/python/typeshed/blob/af8e37d2736d3a6fbed8f5dfad71580dd417c612/tests/check_new_syntax.py
- Collections classes in typing:
typing.Counter-->collections.Counteretc (related: Suggest using collections.abc etc, not typing (deprecated since 3.9) #46) - Built-in generics:
List --> listetc -
typing.(Async)ContextManager-->contextlib.Abstract(Async)ContextManager - Preferring typing over typing_extensions when available:
typing_extensions.ClassVar-->typing.ClassVaretc -
Union[str, int]-->str | int(Suggest using PEP 604-style union types #45) - Banning
from collections.abc import Set, because it's confusingly different from the built-inset - Ordering
sys.version_infochecks so that the most recent version is first - Ban explicitly inheriting from
objectin Python 3-only stubs. - Disallow using
typing.Textin Python 3-only stubs.
We should probably create one error code per Python version, so that it's easy to e.g. enable errors for not using features new in Python 3.8+. Another option would be to make the errors depend on sys.version_info (maybe too clever, would need good documentation).
AlexWaygood