Skip to content

Latest commit

 

History

History
155 lines (106 loc) · 5.78 KB

File metadata and controls

155 lines (106 loc) · 5.78 KB

Creating and Using a Custom objects.inv

The workflow presented here is introduced in the context of manually assembling an objects inventory, but the functionality is mainly intended for use downstream of a web-scraping or other automated content-extraction tool.

A (possibly obsolete) representative example of such a custom |objects.inv| can be found at the GitHub repo here.

Note

These instructions are for |soi| v2.x; the prior instructions for v1.0 can be found here.

  1. Identify the head of the URI to the documentation. |br| |br|

  2. Construct an |Inventory| containing all of the objects of interest. The :attr:`~sphobjinv.data.SuperDataObj.uri` and :attr:`~sphobjinv.data.SuperDataObj.dispname` values can be entered with or without the :ref:`standard abbreviations <syntax_shorthand>`.

  3. Export the |Inventory| in compressed form.

  4. Transfer the compressed file to its distribution location.

    • If only local access is needed, it can be kept local.
    • If external access needed, upload to a suitable host. |br|
  5. Add an element to the |isphxmap|_ parameter in conf.py.

    • The key of the element is an arbitrary name, which can be used to specify the desired documentation set to be searched for the target object, in the event of a name collision between one or more documentation projects; e.g.:

      :meth:`python:str.join`
      
    • The value of the element is a |tuple| of length two:

      • The first element of the value tuple is the head URI for the documentation repository, identified in step (1), to which the :attr:`~sphobjinv.data.SuperDataObj.uri` of given object is appended when constructing an |isphx| cross-reference.
      • The second element of the value tuple can be |None|, in which case the |objects.inv| file is assumed to be at the repository head URI. Otherwise, this element is the complete address of the distribution location of the compressed inventory file, from step (4), whether a local path or a remote URL.

    Examples:

    intersphinx_mapping = {
        # Standard reference to web docs, with web objects.inv
        'python': ('https://docs.python.org/3.13', None),
    
        # Django puts its objects.inv file in a non-standard location
        'django': ('https://docs.djangoproject.com/en/dev/', 'https://docs.djangoproject.com/en/dev/_objects/'),
    
        # Drawing the Sphinx objects.inv from a local copy, but referring to the current web docs
        'sphinx': ('https://www.sphinx-doc.org/en/master/', '/path/to/local/objects.inv'),
    }