[Core] Introduce type for resource dictionaries #48710
Open
Description
Description
I'm not sure if there is currently a way to do this, ideally resource dictionaries would be typed like
class Resources(TypedDict, extra_items=float):
CPU: float
GPU: float
memory: float
object_store_memory: float
I don't think this is currently possible (please let us know if you know it is) -- but will be possible with this PEP: https://peps.python.org/pep-0728/
Use case
This will give people autocomplete in their IDE and make it less likely to mistype the keys in the dict (and still be fully compatible with the current API) :)