Skip to main content

Sphinx extension with some autodoc features for any sources

Project description

Extension for gathering reST documentation from any files. This is a documenter from ext.autodoc.

In current state this extension will only insert reST docs from files to target documentation project without auto generation definitions and signatures.

But it simple and clean to make documentation for API and store documentation strings in the source code.


pip install sphinxcontrib-autoanysrc


Add autoanysrc to extensions list:

extensions = ['sphinxcontrib.autoanysrc', ]

Example of usage:

.. autoanysrc:: blabla
    :src: app/**/*.js
    :analyzer: js


  • src option is the pattern to list source files where docs are stored

  • analyzer option to determine witch analyzer must be used for processing this files

Directive will iterate over app/**/*.js files and process it line by line.

Custom analyzer

autoanysrc allow define custom analyzers.

Define custom analyzer (

# make importtable
sys.path.insert(0, os.path.abspath('.'))

from sphinxcontrib.autoanysrc import analyzers

class CustomAnalyzer(analyzers.BaseAnalyzer):

    def process(self, content):
        Must process content line by line

        :param content: processing file content
        :returns: generator of pairs docs line and line number
        for lineno, srcline in enumerate(content.split('\n')):
            yield 'some parsed doc line from content', lineno

# put analyzer to the autonaysrc setting
autoanysrc_analyzers = {
    'my-custom': 'conf.CustomAnalyzer',

And use it:

.. autoanysrc:: blabla
    :src: ../src/*.js
    :analyzer: my-custom

Default analyzers


Search comments blocks starts by /*””” and ends by */ (inspired by Nuulogic/sphinx-jsapidoc).

.. autoanysrc:: directives
    :src: app/services.js
    :analyzer: js

Where services.js:


The function :func:`someService` does a some function.

function someService(href, callback, errback) {
.. function:: someService(href, callback[, errback])

    :param string href: An URI to the location of the resource.
    :param callback: Gets called with the object.
    :throws SomeError: For whatever reason in that case.
    :returns: Something.
    return 'some result';


  • encoding option

  • allow internal indent in comment block

  • generate signatures like ext.autodoc…

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sphinxcontrib-autoanysrc-0.1.1.tar.gz (5.3 kB view hashes)

Uploaded source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page