typeshed uses Any:As noted in the PR, SimpleNamespace appears to need a plugin to understand specific types of the arguments/keys. It would be a good chance to raise an issue for mypy.On Fri, Aug 18, 2023, 05:08 Paul Moore <p.f.moore@gmail.com> wrote:_______________________________________________On Fri, 18 Aug 2023 at 08:35, Ran Benita via Typing-sig <typing-sig@python.org> wrote:The traditional way plugins did this was to use an attribute on the`item`:def pytest_runtest_setup(item: pytest.Item) -> None:item.my_plugin_attr = MyPluginAttrType(...)def pytest_runtest_teardown(item: pytest.Item) -> None:use_my_attr(item.my_plugin_attr)# Maybedel item.my_plugin_attrThe problem with this is that type checkers are not aware of`my_plugin_attr` and they complain. To make things clean for typecheckers, and type safe (no casts/asserts) an alternative solution isneeded.This sounds very much like `types.SimpleNamespace`. So maybe you could look at how typeshed annotates that type?Paul
Typing-sig mailing list -- typing-sig@python.org
To unsubscribe send an email to typing-sig-leave@python.org
https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.python.org_mailman3_lists_typing-2Dsig.python.org_&d=DwICAg&c=slrrB7dE8n7gBJbeO0g-IQ&r=b_yQYQzY71v5dLCdkk1wmw&m=6lQ43wNegdNVj3Za9br5-RyOkJwinUmtzN-J_GfftL3w_i_sYkcMl-CnfZjDSip7&s=eE1DbZOGV6bB020K1CRny0W8J3Uwe91PceHHHl9s-D8&e=
Member address: zl3464@nyu.edu