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

Generating and using a .pyi without "installing" the module in question? #227

Closed
jandyman opened this issue Aug 22, 2024 · 1 comment
Closed

Comments

@jandyman
Copy link

It seemed to me that from the documentation that I would just open a terminal and say the following to generate the pyi file:

pybind11-stubgen pybind_streaming

Provided that the module is in the current directory. But I get:

ModuleNotFoundError: No module named 'pybind_streaming'

The .so is in the current folder and the full filename is pybind_streaming.cpython-312-darwin.so

It seems I don't understand something very basic. What can I read to straighten my head out? Can .pyi files not be generated for modules that are not installed? I'm still developing the pybind module so it doesn't make sense to install it yet.

I don't use cmake to build my pybind11 modules anymore, due to a weird cmake bug on MacOS. I now use a makefile. That is when all my autocompletion stopped working in ipython, and I'm assuming it has to do with a missing pyi file based on a stack overflow inquiry.

@sizmailov
Copy link
Owner

The module must be importable.

You can test it using the following command to test your setup.

python -c "import pybind_streaming"

Try setting PYTHONPATH before running the command, e.g.:

export PYTHONPATH="$PWD"
pybind11-stubgen pybind_streaming

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