python / importlib_metadata

Library to access metadata for Python packages
https://importlib-metadata.readthedocs.io
Apache License 2.0
122 stars 79 forks source link

Intersphinx mapping for stdlib version #485

Open stefan6419846 opened 3 months ago

stefan6419846 commented 3 months ago

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:

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.)