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

Support Python stub files (.pyi) #167

Closed
mocobeta opened this issue Dec 9, 2023 · 2 comments
Closed

Support Python stub files (.pyi) #167

mocobeta opened this issue Dec 9, 2023 · 2 comments

Comments

@mocobeta
Copy link
Contributor

mocobeta commented Dec 9, 2023

Currently tantivy-py does not include .pyi file, so developers have to investigate the source code to figure out what classes/methods are supported in this package.

PyO3 documentation says:

Yet, for a better user experience, Python libraries should provide typing hints and documentation for all public entities, so that IDEs can show them during development and type analyzing tools such as mypy can use them to properly verify the code.

Currently the best solution for the problem is to manually maintain *.pyi files and ship them along with the package.

It would be great to have tantivy.pyi and py.typed in the Python source dir so that developers get the benefits of powerful IDE suggestions and validate their code by linters such as mypy.
Does this make sense?

Bonus: We could generate API documentation using pdoc by providing .pyi with type stubs.
PyO3/pyo3#2330

@mocobeta
Copy link
Contributor Author

mocobeta commented Dec 9, 2023

I opened a draft PR to add tantivy.pyi. #168

Could you take a look? Thank you!

@cjrh
Copy link
Collaborator

cjrh commented Dec 9, 2023

Done!

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