How to connect to the root page in interphinx

I included sphinx.ext.intersphinxin my project and added the following configuration:

intersphinx_mapping = {
    'python': ('https://docs.python.org/3', None),
    'pyserial': ('https://pythonhosted.org/pyserial/', None),
}

I have the following in mine index.rst:

This project depends on the :ref:`pyserial <pyserial:???>` library.

I want the link to point to the http://pythonhosted.org/pyserial/root url in intersphinx_mapping, but I don't know what ???should be.

If I do :ref:`pyserial`or :ref:`pyserial <pyserial>`, I getWARNING: undefined label: pyserial (if the link has no caption the label must precede a section header)

If I do :ref:`pyserial <>`, I getWARNING: undefined label: (if the link has no caption the label must precede a section header)

I can replace it :ref:with , but I would really like to link to the page through intersphinx to avoid broken links along the line.`pyserial <http://pythonhosted.org/pyserial/>`_

I am using sphinx 1.6.3 on Python 3.6.2 in Anaconda. I did not hang too much in the library I was trying to contact. I suspect the answer will not be tied to the library.

, pyserial docs . , :py:class:`serial.Serial` https://pythonhosted.org/pyserial/pyserial_api.html#serial.Serial.

+4
2

. , .

  • intersphinx.

  • Sphinx objects.inv. sphinx-build :

    loading intersphinx inventory from https://docs.python.org/3/objects.inv...
    loading intersphinx inventory from https://pythonhosted.org/pyserial/objects.inv...
    
  • Python intersphinx , :

    :role_name:`title <target>`
    

    , :

    :ref:`pyserial <pyserial:reference-label-name>`
    
  • , . , , :

    python -m sphinx.ext.intersphinx 'https://pythonhosted.org/pyserial/objects.inv'
    

    API, , :

    std:label
            examples                                 Examples                                : examples.html#examples
            genindex                                 Index                                   : genindex.html#
            miniterm                                 serial.tools.miniterm                   : tools.html#miniterm
            modindex                                 Module Index                            : py-modindex.html#
            search                                   Search Page                             : search.html#
            urls                                     URL Handlers                            : url_handlers.html#urls
    

    - .

    , , .. _my-reference-label:.

, :

:ref:`pyserial <pyserial:genindex>`

... , , , , , . .

+5

@StevePiercy, PR # 261 pyserial. PR , , welcome. -

This project depends on the :ref:`pyserial <pyserial:welcome>` library.

, pyserial docs https://pyserial.readthedocs.io/en/latest/, https://pythonhosted.org/pyserial/, .

+1

Source: https://habr.com/ru/post/1683770/


All Articles