Introducing a v3 objects.inv
(a.k.a intersphinx) format? (and associated logic)
#12204
Replies: 3 comments 2 replies
-
@jakobandersen, @picnixz, etc, perhaps you could outline your thoughts: what you believe the current inadequacies of the format / logic are, what you propose as a solution? thanks! |
Beta Was this translation helpful? Give feedback.
-
I would like to update you on the discussion we had in #11932 where a new intersphinx format is needed (see #11932 (comment)). I especially don't want to implement the v3 I suggested there if we were to change it afterwards. |
Beta Was this translation helpful? Give feedback.
-
Coming from
If I need knowledge of each domain's custom syntax for inventory object information in order to accurately parse it in |
Beta Was this translation helpful? Give feedback.
-
In a number of issues / PRs, there is dicussion of changing the format of the
objects.inv
and/or the code that writes/reads/interprets it (including #8929, #11932, https://github.com/orgs/sphinx-doc/discussions/12152, #12190)I believe this would benefit from a more centralised discussion on the matter.
Intitally here, I attempt to introduce some base context on the subject
The current format (v2)
The current format is written as bytes and contains
An initial utf8 encoded metadata section, continaing metadata for the inventory: version, the project name, the project version, e.g.
A subsequent
zlib
compressed section, providing unique, per line, entries for(target name, domain name, object type, search priority, relative anchor path, display name)
, e.g.The current usage with sphinx domains
In general, per domain, one or more roles are mapped to a single object type.
Usually a reference role (or the special
external
role) will map the role name to an object type, the match this to the entry in theobjects.inv
,e.g.
:external:domain:role:`target`
is resolved as(domain, role -> object type, target name)
in theobjects.inv
The roles can differ mainly:
target
, e.g.:external:py:module:`~target`
allows for partial matches of the full target name<span>
or<code>
to contain the display textPersonal thoughts
By intentional design or not, a result of the "simplicity" and "declarative nature" of the current format/logic, has two benefits:
Firstly, it can be read/interpretted quit easily by external tools, i.e. outside of sphinx
Secondly, it has proven to be quite resilient to change across sphinx versions,
for example, here is the
python
domain objects in v3.0.0 and v7.2.6 which are almost unchangedBecause of this, it is usually possible
objects.inv
created from a remote sphinx project built with an OLDER version of sphinxobjects.inv
created from a remote sphinx project built with a NEWER version of sphinxOne thing I fear, therefore, with making the
objects.inv
more complex, and potentionally more tied to the specific version of sphinx (and its extensions), is that you essentially introduce an additional aspect of depency contraints on the sphinx-build Python environment.If, for example, your project has 5 intersphinx mappings, and all of these projects are built with different sphinx versions, how will you get this to work?
For any proposed solution, I would like to see this addressed
Another aspect I would like to see addressed, is what is the expected behaviour, if an
objects.inv
contains a reference for a domain and/or object type that is not available in the local sphinx environment?A good example of this is user defined
std
object types, viaapp.add_object_type
(see #5562)Beta Was this translation helpful? Give feedback.
All reactions