How to type annotate a dataset which has specific column names

So in our codebase we have a datasets that is off the format

Dataset({
        features: ['questions', 'answers', 'context'],
        num_rows: 57638

we also have version of of that dataset which has

Dataset({
        features: ['questions', 'answers'],
        num_rows: 57638

I was wondering if there was any ways of doing static type checking for this situation where I’m sure of the columns that are present and want the mypy to check if I make errors in code due to incorrect name or missing column

No, this is currently not supported.

Also, I think MyPy needs to implement PEP 646 – Variadic Generics | peps.python.org to support analyzing such type hints.

thanks for the reply. the PEP was indeed helpful!