code: def get_version():
      
      version_regex = re.compile(
          '__version__\\s*=\\s*(?P<q>[\'"])(?P<version>\\d+(\\.\\d+)*(-(alpha|beta|rc)(\\.\\d+)?)?)(?P=q)'
      )
      here = path.abspath(path.dirname(__file__))
      init_location = path.join(here, "CHAID/__init__.py")
  
      with open(init_location) as init_file:
          for line in init_file:
              match = version_regex.search(line)
  
      if not match:
          raise Exception(
              "Couldn't read version information from '{0}'".format(init_location)
          )
  
      return match.group('version')
docs: Read version from __init__.py