【问题标题】:generate a boost-python reference [closed]生成boost-python参考[关闭]
【发布时间】:2012-02-21 09:37:39
【问题描述】:

有人知道如何自动生成我声明的 boost-python 方法的引用:

 def("foo", foo, args("x", "y"), "foo's docstring")
 def("foo2", foo, args("x", "y"), "foo's docstring")
 def("foo3", foo, args("x", "y"), "foo's docstring")
 def("foo4", foo, args("x", "y"), "foo's docstring")

【问题讨论】:

    标签: c++ python boost documentation boost-python


    【解决方案1】:

    您可以使用sphinx。您需要对其进行一些修改以使函数参数列表更漂亮,请参见例如我为 minieigen 做了什么:boost::python sourcesphinx config filegenerated docs

    对于相同但更复杂的内容,请查看Yade

    【讨论】:

      【解决方案2】:

      使用Sphinx,事实上的 Python 文档生成器。无需修改 Sphinx。

      Sphinx 从文档字符串中提取文档,因此添加文档字符串来记录您的 Boost Python 模块。像往常一样将其编译为共享对象(.so 文件)。

      为每个模块创建一个.rst 文件。例如,为模块demo.foo创建demo.foo.rst

      .. automodule:: demo.foo
          :members:
          :undoc-members:
          :show-inheritance:
      

      然后,设置并运行 Sphinx,它会以各种格式为您制作精美的文档。

      【讨论】:

        猜你喜欢
        • 2010-12-05
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-05-04
        • 2010-10-15
        • 2012-11-22
        相关资源
        最近更新 更多