Create the module's index.

def create_autosummary_file(modules, opts):
    # type: (List[unicode], Any, unicode) -> None
    """Create the module's index."""
    lines = [
        'API Reference',
        '=============',
        '',
        '.. autosummary::',
        '   :template: api_module.rst',
        '   :toctree: {}'.format(opts.destdir),
        '',
    ]

    modules.sort()
    for module in modules:
        lines.append('   {}'.format(module))
    lines.append('')

    fname = path.join(opts.srcdir, '{}.rst'.format(opts.docname))
    logger.info('[apigen] creating API docs file: {}'.format(fname))
    with FileAvoidWrite(fname) as f:
        f.write('\n'.join(lines))