-
Notifications
You must be signed in to change notification settings - Fork 127
Open
Feature
0 / 20 of 2 issues completed
Copy link
Labels
typing semanticstyping-module features, spec compliance, etctyping-module features, spec compliance, etc
Milestone
Description
- Introduce a new
Type
variant, basic support for class-basedTypedDict
syntax- Parse a
TypedDict
specification from the class body - Implement / test assignability to
Mapping[str, object]
- Make sure that
TypedDict
-based objects do not behave like instances of that class. For example, attribute access should not work. - Implement fallback to
_typeshed._type_checker_internals.TypedDictFallback
- Add
TypedDict
samples to property tests
- Parse a
- Type inference for key accesses (
movie['directory'] -> str
) - Validation of writes to keys (synthesized
__setitem__
method withkey: Literal["key1"], value: ValueType1
?) - Validation of constructor calls (
Movie(name="Blade Runner", year=1982)
) - Validation of
{…}
literals toTypedDict
types - Totality
-
Required
andNotRequired
-
- Implement / write tests for generic
TypedDict
s - Implement / write tests for recursive
TypedDict
s - Support type inference for
instance.get("known_key")
? - PEP 705 support (
ReadOnly
) - Implement structural assignability for
TypedDict
s #1387 - Support
TypedDict
s in all contexts (return
position, function call arguments, etc) => type context (bidirectional checking) #168 - PEP 728 support ("openness",
extra_items
) - Functional syntax (
Movie = TypedDict('Movie', {'name': str, 'year': int})
) - Support for
Unpack
- Overriding of fields in inheritance
- Correctness, validation
- Implement checks based on supported and unsupported operations
-
TypedDict
type objects cannot be used inisinstance
checks - Only item definitions in the class body (no methods, for example)
- Specifying a metaclass is not allowed
- Can only subclass
TypedDict
,TypedDict
- based types andGeneric
- Implement / write tests for subclassing of
TypedDict
-based classes including multiple inheritance
- Performance
- Try out the optimization proposed in [ty] Infer types for key-based access on TypedDicts ruff#19763 (comment)
- Add a micro-benchmark for large
TypedDict
s
RobertCraigie, terrykong, collinanderson, Thell, rowillia and 24 more
Sub-issues
Metadata
Metadata
Assignees
Labels
typing semanticstyping-module features, spec compliance, etctyping-module features, spec compliance, etc