就狮身人面像而言,我是新手.我的项目结构如下:
> argparse_actions /
> argparse_actions /
> __init__.py
> folder_actions.py
> ip_actions.py
> doc /
> _build /
> index.rst ==>这是起点,主页或根文档.
>等等……
__init__.py看起来像这样:
from folder_actions import *
from ip_actions import *
folder_actions.py看起来像这样:
'''
Folder Actions
==============
This module implements some reusable custom actions.
.. autoclass:: FolderExistsAction
.. autoclass:: FolderCreateAction
:members:
'''
# The rest of the code
生成HTML文档看起来很好,除了这部分:
class folder_actions.FolderCreateAction(…)
我知道folder_actions模块前缀是正确的,但我想改为使用包名称,如下所示:
class argparse_actions.FolderCreateAction(…)
我有办法实现这个目标吗?
更新
>根文档位于doc / index.rst中
>如果我将docstring从folder_actions.py移动到__init__.py,那么doc将如下所示:
class __init__.FolderCreateAction( ... )
>仅供参考,我的项目现在是BitBucket
更新2
我不知道为什么我的更改没有被推到BitBucket,但那无关紧要.请看看同一个项目,推到GitHub.感谢你的帮助,mzjn.
最佳答案 经过几个月的中断后,我终于想出了解决方案:将以下行添加到folder_actions.py和ip_action.py模块的docstring中:
.. module:: argparse_actions
优选地,该行应该是模块docstring的第一行.