Deepwalker / trafaret

Ultimate transformation library that supports validation, contexts and aiohttp.
http://trafaret.readthedocs.org/en/latest/
BSD 2-Clause "Simplified" License
176 stars 32 forks source link

Add type stubs #123

Open achimnol opened 2 years ago

achimnol commented 2 years ago

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.

Deepwalker commented 2 years ago

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.

achimnol commented 2 years ago

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