Skip to content

Instantly share code, notes, and snippets.

@inirudebwoy
Created February 2, 2016 15:45
Show Gist options
  • Save inirudebwoy/2071aae90898997d610e to your computer and use it in GitHub Desktop.
Save inirudebwoy/2071aae90898997d610e to your computer and use it in GitHub Desktop.
Retrievinng version number in setup.py
def get_version():
local_vars = {}
try:
execfile('src/imagination/objectid_manager/__init__.py',
{},
local_vars)
except NameError:
# python3.x does not provide execfile
with open('src/imagination/objectid_manager/__init__.py') as f:
exec(f.read(), {}, local_vars)
return local_vars.get('__version__')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment