I'm using boost::python to transform various C++ classes and functions to
python. It is all working quite well, but now I'm having trouble with
documentation tools.
I hope someone can tell me if the problem is with the doc tools, such as
pydoc, or with boost::python implementation.
If I create a free function, this is what happens:
PyTypeObject function_type = {
PyObject_HEAD_I NIT(0)
0,
"Boost.Python.f unction",
sizeof(function ),
0,
(destructor)fun ction_dealloc, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_compare */
0, //(reprfunc)func_ repr, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
function_call, /* tp_call */
0, /* tp_str */
0, // PyObject_Generi cGetAttr, /* tp_getattro */
0, // PyObject_Generi cSetAttr, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFA ULT /* | Py_TPFLAGS_HAVE _GC */,/* tp_flags */
0, /* tp_doc */
0, // (traverseproc)f unc_traverse, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, //offsetof(PyFunc tionObject, func_weakreflis t), /* tp_weaklistoffs et
*/
0, /* tp_iter */
0, /* tp_iternext */
0, /* tp_methods */
0, // func_memberlist , /* tp_members */
function_getset list, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */
function_descr_ get, /* tp_descr_get */
0, /* tp_descr_set */
0, //offsetof(PyFunc tionObject, func_dict), /* tp_dictoffset */
0, /* tp_init */
0, /* tp_alloc */
0,
0 /* tp_new */
};
Notice the getset member is being set, so I guess this is using the new
descriptor protocol.
As an example:
dir (block_interlea ver_wrap)
['__doc__', '__file__', '__name__', 'block_interlea ver', 'deinterleave',
'deinterleave_c ', 'interleave', 'interleave_c']
the latter 4 are free functions. If I use pydoc, these functions don't
appear.
inspect.ismetho ddescriptor(blo ck_interleaver_ wrap.interleave )
True
inspect.getdoc (block_interlea ver_wrap.interl eave)
'interleave(int er,x)\nInterlea ve input I{x} using interleaver I{inter}@param
inter: stuff'
This is the documentation I wanted.
Anyone know what needs to happen so that tools like pydoc, and especially
epydoc, will correctly find the documentation?
python. It is all working quite well, but now I'm having trouble with
documentation tools.
I hope someone can tell me if the problem is with the doc tools, such as
pydoc, or with boost::python implementation.
If I create a free function, this is what happens:
PyTypeObject function_type = {
PyObject_HEAD_I NIT(0)
0,
"Boost.Python.f unction",
sizeof(function ),
0,
(destructor)fun ction_dealloc, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_compare */
0, //(reprfunc)func_ repr, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
function_call, /* tp_call */
0, /* tp_str */
0, // PyObject_Generi cGetAttr, /* tp_getattro */
0, // PyObject_Generi cSetAttr, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFA ULT /* | Py_TPFLAGS_HAVE _GC */,/* tp_flags */
0, /* tp_doc */
0, // (traverseproc)f unc_traverse, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, //offsetof(PyFunc tionObject, func_weakreflis t), /* tp_weaklistoffs et
*/
0, /* tp_iter */
0, /* tp_iternext */
0, /* tp_methods */
0, // func_memberlist , /* tp_members */
function_getset list, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */
function_descr_ get, /* tp_descr_get */
0, /* tp_descr_set */
0, //offsetof(PyFunc tionObject, func_dict), /* tp_dictoffset */
0, /* tp_init */
0, /* tp_alloc */
0,
0 /* tp_new */
};
Notice the getset member is being set, so I guess this is using the new
descriptor protocol.
As an example:
dir (block_interlea ver_wrap)
['__doc__', '__file__', '__name__', 'block_interlea ver', 'deinterleave',
'deinterleave_c ', 'interleave', 'interleave_c']
the latter 4 are free functions. If I use pydoc, these functions don't
appear.
inspect.ismetho ddescriptor(blo ck_interleaver_ wrap.interleave )
True
inspect.getdoc (block_interlea ver_wrap.interl eave)
'interleave(int er,x)\nInterlea ve input I{x} using interleaver I{inter}@param
inter: stuff'
This is the documentation I wanted.
Anyone know what needs to happen so that tools like pydoc, and especially
epydoc, will correctly find the documentation?