This project is archived. Its data is read-only.

Discover distribution for local package under development

Consider the case where a library wishes to test the Description (or Name or other metadata) of the local project under test. importlib_metadata can return the Description, but only if it knows the Distribution name. One wishes to solicit the metadata for "this" project.

Currently, one can get the name of the current project by way of setuptools by invoking python setup.py --name, but as PEP 517/518 become more popular, that convention becomes less reliable. Moreover, ideally it should be possible to retrieve the information via an API without invoking a subprocess.

I'm thinking something like:

>>> importlib_metadata.metadata(importlib_metadata.local_name())['Description']
'...'

If the Distribution class were more public, I'd suggest:

>>> importlib_metadata.Distribution.local().metadata()['Description']
Edited Dec 01, 2018 by Jason R. Coombs
Assignee Loading
Time tracking Loading