pybind11-stubgen
pybind11-stubgen copied to clipboard
Where to store the generated stubs?
I have generated stubs for a pip installed module (generated with pybind11) to aid with development.
I have pyright as my Language Server Protocol (LSP). Where should I put the generated stubs for pyright (or any other LSP) to read them?
Thanks!
I have the following directory structure:
./rpydemo/
./rpydemo/py.typed
./rpydemo/_rpydemo.cpython-311-x86_64-linux-gnu.so
./rpydemo/_rpydemo/
./rpydemo/_rpydemo/__init__.pyi
Do you have an example library where you run stub generation during the building process (pip install .)? I have this project, and I would like to somehow get the generator to run and install the stub with the library. I assume there should be some way to achieve this either in the pyproject.toml or setup.py?
@5had3z see https://github.com/sizmailov/pybind11-stubgen/issues/104#issuecomment-1706128213
@sizmailov is it bad idea to put stubs directly to the same directory? With:
pybind11-stubgen -o ...my_env/lib/python3.11/site-packages/ --root-suffix "" <lib_name>