sizmailov / pybind11-stubgen

Generate stubs for python modules
Other
218 stars 44 forks source link

Can't generate stubs for pybind11 shared object #210

Closed HendrikHuebner closed 4 months ago

HendrikHuebner commented 4 months ago

I have a pybind module called libtest.cpython-311-x86_64-linux-gnu.so and I'm trying to use this tool to generate stubs for it. I can import "libtest" in a python file in the same folder and make calls to its functions but without the stub my IDE will mark everything as an error. Running pybind11-stubgen libtest or pybind11-stubgen libtest.cpython-311-x86_64-linux-gnu.so just results in an error containing: ModuleNotFoundError: No module named 'libtest'

Am I using this tool correctly?

sizmailov commented 4 months ago

The module should be importable by python interpreter. You should provide the module name, e.g. pybind11-stubgen libtest. Add the path to .so file to PYTHONPATH env variable.

HendrikHuebner commented 4 months ago

Ah, adding it to $PYTHONPATH has solved the issue. Thanks.