Skip to content

dahlia/sphinx-fakeinv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sphinx-fakeinv: Generate fake Intersphinx inventory

Latest PyPI version

Build Status

Sometimes we create so tiny libraries that we don't need write docs using Sphinx for them, but at the same time we may want to link them from other docs written using Sphinx.

This utility helps us to generate a fake objects.inv file (it's also known as Sphinx inventory) so that other Sphinx docs can link it through the Intersphinx extension.

Installation

It's uploaded to PyPI, so you can install it using pip:

$ pip install sphinx-fakeinv

Usage

Suppose you've just written a tiny module named foobar. You can generate a fake objects.inv for it by the following command:

$ sphinx-fakeinv foobar > objects.inv

The shinx-fakeinv program automatically scans the submodules, subpackages, and classes/functions/exceptions/variables in all of scanned modules/packages. (Note that it's aware of __all__ list if there's one.)

If you want to link it from other Sphinx docs, you need to manually add the url of it (of course you need to upload the generated fake objects.inv somewhere like gh-pages) to intersphinx_mapping configuration:

intersphinx_mapping = {
    'foobar': (
        'https://github.com/example/foobar',            # The project website
        'https://example.github.io/foobar/objects.inv'  # The fake inventory
    ),
}

That's done! If you make references to foobar e.g.:

If :mod:`foobar` module is available at runtime this function will uses
internally :func:`foobar.baz()`.

Links in the above example like foobar and foobar.baz() will refer to https://github.com/example/foobar.

Author and license

Written by Hong Minhee. Distributed under GPLv3 or later.