sphinx-doc/sphinx

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

Open

#8 547 ouverte le 17 déc. 2020

Voir sur GitHub
 (7 commentaires) (2 réactions) (0 assignés)Python (1 985 forks)batch import
extensions:autodochelp wantedtype:bug

Métriques du dépôt

Stars
 (5 625 stars)
Métriques de merge PR
 (Merge moyen 10j 11h) (11 PRs mergées en 30 j)

Description

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.

Guide contributeur