trafaret icon indicating copy to clipboard operation
trafaret copied to clipboard

Add type stubs

Open achimnol opened this issue 3 years ago • 2 comments

When importing trafaret from a type-checked codebase, it often generates type check failures (mypy) due to missing explicit __rshift__() method declaration and -> NoReturn for the Trafaret._failure() method.

I'm currently workarounding the issue by adding a custom stubs: https://github.com/lablup/backend.ai-common/tree/main/stubs/trafaret

It would be nice if we could embed the type stubs or provide a separate type stubs package. You may start from my privately written type stubs.

For details about writing/distributing type stubs, refer PEP-561.

achimnol avatar May 10 '22 17:05 achimnol

Can I ask you to create PR with stubs, that you think we should include into trafaret? Not sure when I will be able to do it myself.

Deepwalker avatar May 12 '22 08:05 Deepwalker

I'll make a PR to add some essential type annotations directly as .pyi files, which would sync better and be easier to maintain.

achimnol avatar May 13 '22 07:05 achimnol