So, I have the following Python code residing in the __init__.py
file of my Python project which I autogenerated using PyScaffold.
from pkg_resources import get_distribution, DistributionNotFound
try:
# Change here if project is renamed and does not equal the package name dist_name = 'mlfq-sim'
__version__ = get_distribution(dist_name).version
except DistributionNotFound: # pragma: no cover # Can't unit test this for now since I do not know how to temporarily # remove a distribution during runtime. Help. Also, is this even # worth it? __version__ = 'unknown'
Enter fullscreen mode Exit fullscreen mode
I get that it gets the version of my project. But how does it do it? Is there a benefit in using it compared to the one below?
__version__ = 'some version'
Enter fullscreen mode Exit fullscreen mode
© 版权声明
THE END
暂无评论内容