mr-ubik / tensorflow-intersphinx

Provide a Sphinx Inventory file to enable intersphinx reference with TensorFlow Documentation.
5 stars 3 forks source link
documentation scrapy sphinx tensorflow

TensorFlow Intersphinx

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg :target: https://github.com/psf/black


This repository contains the Sphinx Inventory of the TensorFlow 2.4 API and the TensorFlow Probability 0.12 API together with the scraper and conversion script used to generate it.

Intersphinx Usage

To enable these intersphinx inventories in your Sphinx documentation, add the following items inside the intersphinx_mapping dictionary in your Sphinx configuration (conf.py).

For TensorFlow,

For TensorFlow Probability,

Example

.. code:: python

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
    "numpy": ("https://numpy.org/doc/stable/", None),
    "python": ("https://docs.python.org/3/", None),
    "tensorflow": (
        "https://www.tensorflow.org/api_docs/python",
        "https://github.com/GPflow/tensorflow-intersphinx/raw/master/tf2_py_objects.inv"
    ),
    "tensorflow_probability": (
        "https://www.tensorflow.org/probability/api_docs/python",
        "https://github.com/GPflow/tensorflow-intersphinx/raw/master/tfp_py_objects.inv"
    ),
}

Find the correct reference

You can view the contents of the inventories by running python -msphinx.ext.intersphinx tf2_py_objects.inv or python -msphinx.ext.intersphinx tfp_py_objects.inv The output is separated into classes, functions, and modules.

Regenerate the Sphinx Inventories

These steps can be run all-in-one using the regenerate.sh shell script.

Note that the TensorFlow and TensorFlow Probability versions (displayed as part of the intersphinx links in your docs) are hard-coded in inventipy.py, and have to be updated in there as required.

Contributing