Sphinx: private methods and arguments ignored with -P / --private argument for sphinx-apidoc

Created on 8 Dec 2019  路  6Comments  路  Source: sphinx-doc/sphinx

Describe the bug
When using the -P or --private arguments for sphinx-apidoc the private methods are not listed in the resulting documentation.

To Reproduce
I run sphinxcontrib-apidoc in my project but the same occurs when using sphinx-apidoc directly from my tox file.

sphinx-apidoc -P -o doc/source/source_documentation radloggerpy/tests
sphinx-build -W -b html doc/source doc/build/html

Expected behavior
I expect the doc/source/source_documentation to contain source code documentation including private methods and attributes. However, the private methods and attributes are not included in the documentation even though they have documentation.

Your project
https://github.com/Dantali0n/radloggerpy

Screenshots
This screenshot shows the documentation of a method that is private:
Screenshot from 2019-12-08 08-38-55

This screenshot shows that the documentation is missing from the generated output:
Screenshot from 2019-12-08 08-39-54

Environment info

  • OS: Linux (Ubuntu 18.04 LTS x64)
  • Python version: 3.6.8
  • Sphinx version: 2.2.1
  • Sphinx extensions: sphinx.ext.autodoc, sphinx.ext.viewcode, sphinxcontrib.apidoc, sphinx_rtd_theme, cliff.sphinxext
  • Extra tools: tox, pbr

Additional context
The behavior is the same if -P or --private is used.
I first submitted the bug to sphincontrib-apidoc here is the reference:
https://github.com/sphinx-contrib/apidoc/issues/14

apidoc bug

All 6 comments

+1 I have the same issue, I am using sphinx v2.3.1 and when using sphinx-apidoc with option -P or --private is not picking the private members.

Working way to get the private methods into the sphinx htmls is using the autodoc_default_options in _config.py_ like below:

autodoc_default_options = {'private-members': True}

Thank you for reporting. I just made a PR #7066 to fix this. But I'm not familiar with apidoc. Can anyone try this please? You can use this with pip install git+https://github.com/tk0miya/sphinx@6899_apidoc_private_members command.

Just tested, works for me :+1:

Tested and verified, thanks @tk0miya

Thank you for confirmation!

Merged. Thank you for your help!

Was this page helpful?
0 / 5 - 0 ratings