I'm trying to retrieve metadata information for a python package given the name of the module.
I can use importlib-metadata to retrieve the information, but in some cases the top-level module name is not the same as the package name.
example:
>>> importlib_metadata.metadata('zmq')['License'] Traceback (most recent call last): File "<stdin>", line 1, in <module> File "c:\Users\xxxxx\AppData\Local\Programs\Python\Python37\Lib\site-packages\importlib_metadata\__init__.py", line 499, in metadata return Distribution.from_name(distribution_name).metadata File "c:\Users\xxxxx\AppData\Local\Programs\Python\Python37\Lib\site-packages\importlib_metadata\__init__.py", line 187, in from_name raise PackageNotFoundError(name) importlib_metadata.PackageNotFoundError: zmq >>> importlib_metadata.metadata('pyzmq')['License'] 'LGPL+BSD'