That code runs for me (3.13.1), and checks out with mypy (1.13.0 (compiled: yes)) (after importing TypedDict). This too:
from typing import TypedDict
class MyClass(TypedDict):
"""runtime config"""
r_config: bool
"""runtime config 2"""
r_config_2: bool
MyClass.__doc__ is the first one (runtime_config). The r_config(_2)? are names for dictionary keys not class variables, so I’m not sure where to look for doc strings, and wouldn’t expect them to have them.
In Python, the convention is to put the doc string below the thing that it documents, instead of above.
When I put the above code in VSCode and put my mouse over r_config, a mouseover tooltip appears with the docstring “runtime config 2”. So “runtime config 2” is associated with r_config.
If I use this code:
class MyClass(TypedDict):
""" class docstring here """
r_config: bool
""" runtime config """
r_config_2: bool
""" runtime config 2 """
I can put my mouse over r_config and see “runtime config” in the tooltip.
I can put my mouse over r_config_2 and see “runtime config 2” in the tooltip.
I can put my mouse over MyClass and see “class docstring here” in the tooltip.