sphinx-doc/sphinx

autodoc autmodule not picking up on reimported module-level constant variable

Open

#8,547 创建于 2020年12月17日

在 GitHub 查看
 (7 评论) (2 反应) (0 负责人)Python (1,985 fork)batch import
extensions:autodochelp wantedtype:bug

仓库指标

Star
 (5,625 star)
PR 合并指标
 (平均合并 10天 11小时) (30 天内合并 11 个 PR)

描述

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

git clone https://github.com/DamSenViet/kle-py.git
cd kle-py

# checkout the commit with the issue
git checkout 26e6d7c1ba44c670c7213f1895c21afcc5a67c1c

# install/update egg the with dev dependencies
pip3 install -Ue .[dev]
./scripts/build-docs.sh && ./scripts/dev-docs.sh

Expected behavior An imported constant variable, kle_dps should have been documented by automodule.

Your project https://github.com/DamSenViet/kle-py/tree/26e6d7c1ba44c670c7213f1895c21afcc5a67c1c

Screenshots If applicable, add screenshots to help explain your problem.

Environment info

  • OS: Mac
  • Python version: 3.9
  • Sphinx version: 3.3.1
  • Sphinx extensions: [sphinx.ext.autodoc, sphinx.ext.autodoc.typehints, sphinx.ext.autosummary, sphinx.ext.githubpages]

Additional context

For additional context, kle_dps is an imported module-level constant from another submodule, damsenviet.kle.utils (and is documented there).

Note that I included kle_dps in __all__ in both the damsenviet.kle.__init__.py and damsenviet.kle.utils.py.

However, kle_dps isn't in the API reference page for damsenviet.kle but does show up in damsenviet.kle.utils.

I expected the same behavior as documenting functions and classes.

I suspect that autodoc's automodule isn't picking up on an imported module-level constant. Even when I don't have an __all__ present in the files, automodule still fails to pick up on it.

贡献者指南