I used PyScaffold to create a template for a PyPi package I am creating, bbox-utils
. The generated __init__.py
is as follows:
from pkg_resources import DistributionNotFound, get_distribution
try:
# Change here if project is renamed and does not equal the package name
dist_name = "bbox-utils"
__version__ = get_distribution(dist_name).version
except DistributionNotFound: # pragma: no cover
__version__ = "unknown"
finally:
del get_distribution, DistributionNotFound
I'm a bit confused what name to use for dist_name
. I tried doing:
>>> from pkg_resources import DistributionNotFound, get_distribution
>>> get_distribution('bbox_utils').version
'0.0.1'
>>> get_distribution('bbox-utils').version
'0.0.1'
and I get the same version whether I replace the hyphen with an underscore or leave it as is. Which should I do?