def get_version(
        here_path,
        default_version=DEFAULT_VERSION,
):
    """tries to resolve version number

    Args:
        here_path (str): path to project local dir
        default_version (str): what version to return if all else fails

    Returns:
        str: semantic_version information for library

    """
    if 'site-packages' in here_path:
        # Running as dependency
        return _version_from_file(here_path)

    if os.environ.get('TRAVIS_TAG'):
        # Running on Travis-CI: trumps all
        if not TEST_MODE:  # pragma: no cover
            return os.environ.get('TRAVIS_TAG').replace('v', '')
        else:
            warnings.warn(
                'Travis detected, but TEST_MODE enabled',
                exceptions.ProsperVersionTestModeWarning)

    try:
        current_tag = _read_git_tags(default_version=default_version)
    except Exception:  # pragma: no cover
        return _version_from_file(here_path)

    # TODO: if #steps from tag root, increment minor
    # TODO: check if off main branch and add name to prerelease

    with open(os.path.join(here_path, 'version.txt'), 'w') as v_fh:
        # save version info somewhere static
        v_fh.write(current_tag)

    return current_tag
def get_version ( here_path , default_version = DEFAULT_VERSION , ) : if 'site-packages' in here_path : return _version_from_file ( here_path ) if os . environ . get ( 'TRAVIS_TAG' ) : if not TEST_MODE : return os . environ . get ( 'TRAVIS_TAG' ) . replace ( 'v' , '' ) else : warnings . warn ( 'Travis detected, but TEST_MODE enabled' , exceptions . ProsperVersionTestModeWarning ) try : current_tag = _read_git_tags ( default_version = default_version ) except Exception : return _version_from_file ( here_path ) with open ( os . path . join ( here_path , 'version.txt' ) , 'w' ) as v_fh : v_fh . write ( current_tag ) return current_tag
tries to resolve version number

    Args:
        here_path (str): path to project local dir
        default_version (str): what version to return if all else fails

    Returns:
        str: semantic_version information for library