pybind / pybind/pybind11-stubgen

Failed to generate stub file for my package

Open
#237 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
361
Forks
75
PR merge metrics
No merged PRs in 30d

Description

The pybind11 code to generate module is:

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:

image

Then, I want to generate the stub file for this module. I have tested the pybind11-stubgen, and it works:
image

However, it failed when generate stub file for my-self package:
image

How should I use the pybind11-stubgen?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the pybind11-stubgen command against the package described in the issue and inspect the failure shown in the attached screenshot. Compare it with the successful module-generation and stub-generation examples; the work is done when the package's Python module produces a usable stub file.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.