code: def get_version(pep440=False):
      """Tracks the version number.
  
      pep440: bool
          When True, this function returns a version string suitable for
          a release as defined by PEP 440. When False, the githash (if
          available) will be appended to the version string.
  
      If the script is located within an active git repository,
      git-describe is used to get the version information.
  
      Otherwise, the version logged by package installer is returned.
  
      If even that information isn't available (likely when executing on a
      remote cloud instance), the version information is returned from INFO file
      in the current directory.
  
      """
  
      version = format_git_describe(call_git_describe(), pep440=pep440)
      version_addl = None
      if version is None:  # not a git repository
          import metaflow
  
          version = metaflow.__version__
          version_addl = metaflow.__version_addl__
      if version is None:  # not a proper python package
          return read_info_version()
      if version_addl:
          return "+".join([version, version_addl])
      return version
  
file_path: metaflow/metaflow/metaflow_version.py
imports: from subprocess import check_output, CalledProcessError
  from os import path, name, devnull, environ, listdir
  import json
  from metaflow import CURRENT_DIRECTORY, INFO_FILE
label_desc: Use image node_id 4 for calling a global function with example usage: get_version(pep440) and returns: version, read_info_version, str