如何在Jython项目中创建基于sphinx的文档?

2024-05-11 09:55:51 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用用Java编写的库处理几个Jython项目。多亏了autodoc扩展,我想用Sphinx创建一些好的文档。但是,当我尝试创建html时,我遇到了错误,因为autodoc找不到用Java编写的库:

sphinx-build -b html -d _build/doctrees   . _build/html
Running Sphinx v1.0.5
loading pickled environment... done
building [html]: targets for 1 source files that are out of date
updating environment: 0 added, 1 changed, 0 removed
reading sources... [100%] index

/Users/myName/myJythonProject/doc/index.rst:14: (WARNING/2) 
autodoc can't import/find module 'myJythonProject', it reported error: 
"global name 'PoolManager' is not defined",
please check your spelling and sys.path

其中PoolManager是一个Java类。在

有谁能帮我解决这个问题吗?在


Tags: 项目文档buildindexenvironmenthtml错误sphinx
1条回答
网友
1楼 · 发布于 2024-05-11 09:55:51

Sphinx可以用来记录Jython项目,但是autodoc不适用于用Java编写的代码。autodoc特性导入并检查Python模块。Java类不支持这样做。在

为Java实现autodoc(或类似的东西)似乎可行,但必须有人自愿去做。请参阅斯芬克斯作者乔治布兰德尔的评论:http://www.mail-archive.com/sphinx-dev@googlegroups.com/msg03162.html。在

我发现了一些关于a proposed GSoC 2010 project的信息,旨在实现对autodoc的多语言支持。但是根据this blog post的说法,这个项目没有完成。开发人员选择了另一个GSoC项目。在

sphinx-contrib repository不包含与autodoc相关的任何内容。在


更新

有一个名为javasphinx的狮身人面像扩展,看起来很有趣。我没有使用这个扩展,但是根据the documentation,它可以从Java代码生成reST源:

^{bq}$

javasphinx使用了另一个名为javalang的库。在

PyPI包:

相关问题 更多 >