importlib_metadata icon indicating copy to clipboard operation
importlib_metadata copied to clipboard

Intersphinx mapping for stdlib version

Open stefan6419846 opened this issue 10 months ago • 0 comments

In my code, I have type hints which refer to importlib.metadata. The corresponding docs at https://docs.python.org/3/library/importlib.metadata.html point to the docs of importlib_metadata for the API reference and do not explicitly list the API details. importlib_metadata provides them.

Now I am trying to generate docs using Sphinx and utilize the intersphinx mapping functionality to link to importlib.metadata members. With this, I am in the situation that I would have to use importlib_metadata only to ensure that the docs and especially the intersphinx mappings work correctly and I have no undefined references.

At the moment, there basically are two mapping files:

  • The stdlib one does not provide references for importlib.metadata as the API reference is not part of the stdlib docs.
  • The importlib_metadata one provides references for importlib_metadata imports, but not for the importlib.metadata ones.

My current workaround is to basically generate a custom version of the importlib_metadata intersphinx mapping which replaces all importlib_metadata names with importlib.metadata, but this does not feel like a good solution.

What is the correct approach to get the intersphinx mapping working for both the stdlib and standalone versions without having to solely rely on the standalone version? (Please note that I am not sure which issue tracker is more suitable for this, but as the standalone version provides the API reference, I just went with this repository for now.)

stefan6419846 avatar Apr 07 '24 13:04 stefan6419846