Inconsistent version number returned for built-in packages because inconsistent distribution is returned
On my environment (python 3.7 miniconda windows) it seems that version()
does not work correctly: it returns '5.0.0' for built-in packages 'collections' and 'html'. Digging a bit I found that this is because distribution
does not work correctly:
from importlib_metadata import distribution
dist = distribution('collections') # you can try with 'html' too
print(dist.metadata['Name'])
assert dist.metadata['Name'] == 'collections' # fails: the name of the distribution found is 'more-itertools' !!
Is this platform-specific or broader ?