from email.message import EmailMessage
from email.headerregistry import Address
msg = EmailMessage()
msg['From'] = Address("Pepé Le Pew", "pepe", "example.com")
$ mypy test_mypy.py
test_mypy.py:5: error: Incompatible types in assignment (expression has type "Address", target has type "Union[str, Header]")
EmailMessage.__setitem__should supportAddressas a value. At least the Python docs email example think it does. See https://docs.python.org/3/library/email.examples.htmltest_mypy.py:
And then: