-
Notifications
You must be signed in to change notification settings - Fork 133
Open
Feature
0 / 20 of 2 issues completed
Copy link
Labels
typeddicttyping semanticstyping-module features, spec compliance, etctyping-module features, spec compliance, etc
Milestone
Description
- Introduce a new
Typevariant, basic support for class-basedTypedDictsyntax- Parse a
TypedDictspecification 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
TypedDictsamples 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 toTypedDicttypes - Totality
-
RequiredandNotRequired
-
- Implement / write tests for generic
TypedDicts - Implement / write tests for recursive
TypedDicts - Support type inference for
instance.get("known_key")? - PEP 705 support (
ReadOnly) - Implement structural assignability for
TypedDicts #1387 - Support
TypedDicts in all contexts (returnposition, 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
-
TypedDicttype objects cannot be used inisinstancechecks - 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
TypedDicts
RobertCraigie, terrykong, collinanderson, Thell, rowillia and 25 more
Sub-issues
Metadata
Metadata
Assignees
Labels
typeddicttyping semanticstyping-module features, spec compliance, etctyping-module features, spec compliance, etc