How to get sphinx to document a package's __init__.py file
Asked Answered
S

1

9

I have a package I would like to document with sphinx. The package consists of a few native modules (generated using boost-python) and an __init__.py

The __init__.py does a bunch of (documented) monkey patching of the boost-python modules and provides a bunch of convenience functions.

I haven't been able to figure out how to tell sphinx to generate package level documentation based on the __init__.py. All I've found in my searching is how to get sphinx to generate documentation from a class __init__ method, which is not what I'm after.

Shurwood answered 20/11, 2016 at 17:25 Comment(3)
.. automodule:: yourpackage should work, with the :members: option.Aguiar
@Aguiar I actually ran sphinx-apidoc -f ... and .. automodule:: mypackage was generated along with the :members: option. No luck. :(Shurwood
Tested today, still an issue for me.Abb
M
0

In my case I just use the command sphinx-apidoc -f -e -o ./source .. and for my packages in "Module contents" section of documentation I got docstrings from __init__.py. By the way, you should have a look at the imports in the modules - while I had some wrong imports, these files were skipped. After fixes I got documentation.

Mefford answered 23/5, 2023 at 17:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.