I want to use sphinx's autodoc-skip-member event to select a portion of the members on a certain python class for documentation.
But it isn't clear from the sphinx docs, and I can't find any examples that illustrate: where do I put the code to connect this? I see Sphinx.connect and I suspect it goes in my conf.py, but when I try variations on this code in conf.py I can't find the app object that I should connect():
def maybe_skip_member(app, what, name, obj, skip, options): print app, what, name, obj, skip, options return False # This is not even close to correct: #from sphinx.application import Sphinx #Sphinx().connect('autodoc-skip-member', maybe_skip_member)
A pointer to a simple example would be ideal.
ext. autodoc – Include documentation from docstrings. This extension can import the modules you are documenting, and pull in documentation from docstrings in a semi-automatic way.
Sphinx AutoAPI provides "autodoc" style documentation for multiple programming languages without needing to load, run, or import the project being documented. In contrast to the traditional Sphinx autodoc, which is Python-only and uses code imports, AutoAPI finds and generates documentation by parsing source code.
sphinx-apidoc is a tool for automatic generation of Sphinx sources that, using the autodoc extension, document a whole package in the style of other automatic API documentation tools. MODULE_PATH is the path to a Python package to document, and OUTPUT_PATH is the directory where the generated sources are placed.
Aha, last ditch effort on a little googling turned up this example, scroll down to the bottom. Apparently a setup() function in conf.py will get called with the app. I was able to define the following at the bottom of my conf.py:
def maybe_skip_member(app, what, name, obj, skip, options): print app, what, name, obj, skip, options return True def setup(app): app.connect('autodoc-skip-member', maybe_skip_member)
Which is obviously useless (it skips everything), but that's the minimal example I was looking for and couldn't find...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With