Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add type hint annotations for user-facing code #258

Open
namurphy opened this issue Jan 4, 2024 · 2 comments
Open

Add type hint annotations for user-facing code #258

namurphy opened this issue Jan 4, 2024 · 2 comments

Comments

@namurphy
Copy link

namurphy commented Jan 4, 2024

For the developers of packages that make use of wrapt, it would be helpful for user-facing objects to have type hint annotations.

As an example use case, I'm adding static type checking with mypy to the continuous integration suite of a package. This particular package uses wrapt in a decorator that we use frequently throughout the package. Because mypy follows dependencies, it was unable to fully type check our usage of @wrapt.decorator. We added a rudimentary type stub file in PlasmaPy/PlasmaPy#2442 to get around this limitation. It would be helpful to have the type hints in @wrapt.decorator itself, as well as other widely used code.

The mypy documentation has a section on annotating decorators.

Thank you for creating a wonderful package!

@namurphy
Copy link
Author

namurphy commented Jan 4, 2024

I just saw that there is a PR in progress (#225) which would add a .pyi file for @wrapt.decorator. Since wrapt now appears to be Python 3.6+, an alternative would be to add the type hint annotations directly to the .py file itself in the signature line of @wrapt.decorator.

@dimaqq
Copy link

dimaqq commented Mar 19, 2024

Yes, please :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants