Sphinx Public API API Documentation

I have a large number of python files and I would like to create public API documentation for my project. All the functions that are part of the api, I decorated with a decorator.

eg:

@api
def post_comment(comment)"
    """ Posts a coment
    """
    pass

In the same classes, there are other public methods. The API is distributed among several files, each file defines classes using methods, and some methods have this @api decorator. How can I tell Sphinx to create documents for public API only?

+5
source share
1 answer

I answer my question ... After a few more searches, I found this:

http://sphinx.pocoo.org/ext/autodoc.html#event-autodoc-skip-member

conf.py, , .

conf.py ( sphinx)

def my_doc_skip(app, what, name, obj, skip, options):
    if what != "method":
        return True

    # if obj is decorated with @api
    #     return True
    # return False

def setup(app):
    app.connect('autodoc-process-docstring', my_process_docstring)
    app.connect('autodoc-skip-member', my_doc_skip)

docstring .

+3

All Articles