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

error: Name "capsule" is not defined #86

Closed
mdorier opened this issue Sep 29, 2022 · 2 comments
Closed

error: Name "capsule" is not defined #86

mdorier opened this issue Sep 29, 2022 · 2 comments

Comments

@mdorier
Copy link

mdorier commented Sep 29, 2022

I have a pybind11-based library that uses capsules (pybind11::capsule). When I try to use the stubs generated by pybind11-stubgen with mypy, I'm getting a lot of errors like the following:

stubs/_pymargo-stubs/__init__.pyi:318: error: Name "capsule" is not defined

This can be fixed by manually adding the "capsule" class to init.pyi, but it would be better if pybind11-stubgen could do it by itself.

@sizmailov
Copy link
Owner

Hi, thanks for the report.

PyCapsule does not provide any python interface to interact with, therefore it would be perfectly fine to annotate it as Any

_my_capsule: typing.Any  # PyCapsule()

... or even remove it from the stubs altogether (since you can't do much with it from python).

I'm inclined to implement the first option.

@sizmailov
Copy link
Owner

Closed by 1067124

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