You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class A
{
public:
A()
{
}
/**
* @brief explanation from c++
*/
int Add(int a, int b)
{
return a+b;
}
};
PYBIND11_MODULE(module, m) {
m.doc() = "My Library Python Bindings";
py::class_<A>(m, "A")
.def(py::init<>())
.def("Add", &A::Add, "explanation from pybind");
}
And it successfully generated a python module, and I can import it:
Then, I want to generate the stub file for this module. I have tested the pybind11-stubgen, and it works:
However, it failed when generate stub file for my-self package:
How should I use the pybind11-stubgen?
The text was updated successfully, but these errors were encountered:
I would double check you are using the same Python interpreter for your pybind11-stubgen and your project module.
It looks to me like your pybind11-stubgen Python interpreter is the one in your Anaconda3 environment, while you installed your module into your system Python 3.9.20 environment.
The pybind11 code to generate module is:
And it successfully generated a python module, and I can import it:
Then, I want to generate the stub file for this module. I have tested the

pybind11-stubgen
, and it works:However, it failed when generate stub file for my-self package:

How should I use the
pybind11-stubgen
?The text was updated successfully, but these errors were encountered: