Open dimaqq opened 2 weeks ago
What's the motivation for this? Are they being removed from typing_extensions
, or is there some other reason?
The motivation is to avoide the if TYPE_CHECKING:
block.
The Required/NotRequired are used in TypedDict definitions, which means that TypedDict's can't be used without quotes. Granted, those typed dicts are internal.
I think it may partially help with the following comment for public typed dicts:
# In Python 3.11+ 'services' and 'labels' should be NotRequired, and total=True.
The latter could be an improvement for our library users, maybe?
Possibly related: #1336
The code is really simple:
https://github.com/python/typing_extensions/blob/70cec91bec65155dc339d631ede2a933582558df/src/typing_extensions.py#L2220-L2256
We're using:
Required
in ops/charm.pyNotRequired
in ops/pebble.pyNotRequired
in test/fake_pebble.py