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

Type declarations to allow integration with type checking and linting tools #496

Open
SkwalExe opened this issue Jul 17, 2024 · 2 comments

Comments

@SkwalExe
Copy link

I use Gmpy2 in several projects, and I've found it difficult to integrate the library with type checking and linting tools such as Ruff or Pyright. The main issue is that the PyPI package doesn't include type declarations (.pyi files).

Do you have any plans to publish type declaration files with the package, or make them available through another channel? Or is there another way to perform linting and type checking on projects using gmpy2? I am surprised that this issue has not been discussed, since type checking and linting are very important to any projects.

@skirpichev
Copy link
Contributor

I was planing to add support for return annotations in the __text_signature__. That will allow to describe typing information via docstring. Now this works with the sphinx (see e.g. this), but that information isn't available for introspection with inspect module, for type checkers, etc.

Here is the d.p.o thread: https://discuss.python.org/t/type-signatures-for-extension-modules-pep-draft/43914

One suggestion was: support *.pyi files as a source for the inspect module. Maybe someday I'll find a time to create a feature request.

So, I think *.pyi stub files - a good thing to have.

@skirpichev
Copy link
Contributor

See python/cpython#121945, however.

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