Make __version__ a module-level attribute
By moving __version__ to __init__.py, it becomes an attribute of the module. This is recommended in PEP 396 and a common practice in many contemporary packages. This enables the following: >>> import mypackage >>> print(mypackage.__version__) '5.2.0'
This commit is contained in:
parent
8aa151e46e
commit
aa60dc88c2
@ -1 +1,5 @@
|
|||||||
|
|
||||||
|
from .__version__ import VERSION
|
||||||
|
__version__ = '.'.join(map(str, VERSION))
|
||||||
|
|
||||||
from .core import *
|
from .core import *
|
||||||
|
|||||||
@ -4,5 +4,3 @@
|
|||||||
# 88 YY 88 dP 88 dP""""Yb YboodP 88 Yb dP""""Yb YboodP 888888
|
# 88 YY 88 dP 88 dP""""Yb YboodP 88 Yb dP""""Yb YboodP 888888
|
||||||
|
|
||||||
VERSION = (5, 2, 0)
|
VERSION = (5, 2, 0)
|
||||||
|
|
||||||
__version__ = '.'.join(map(str, VERSION))
|
|
||||||
|
|||||||
1
setup.py
1
setup.py
@ -50,6 +50,7 @@ about = {}
|
|||||||
if not VERSION:
|
if not VERSION:
|
||||||
with open(os.path.join(here, NAME, '__version__.py')) as f:
|
with open(os.path.join(here, NAME, '__version__.py')) as f:
|
||||||
exec(f.read(), about)
|
exec(f.read(), about)
|
||||||
|
about['__version__'] = '.'.join(map(str, about['VERSION']))
|
||||||
else:
|
else:
|
||||||
about['__version__'] = VERSION
|
about['__version__'] = VERSION
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user