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

Where to store the generated stubs? #201

Open
phcerdan opened this issue Nov 26, 2023 · 5 comments
Open

Where to store the generated stubs? #201

phcerdan opened this issue Nov 26, 2023 · 5 comments
Labels
question Further information is requested

Comments

@phcerdan
Copy link

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!

@virtuald
Copy link
Contributor

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

@sizmailov sizmailov added the question Further information is requested label Nov 27, 2023
@5had3z
Copy link

5had3z commented Nov 27, 2023

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?

@sizmailov
Copy link
Owner

@5had3z see #104 (comment)

@5had3z
Copy link

5had3z commented Nov 27, 2023

@5had3z see #104 (comment)

I'm able to get it in a single pass here with my additional flag.

@martincerven
Copy link

@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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants