code: def get_git_derived_build_number(repo, commit_path):
      """
      Get a build number counting from the last commit of a specified file.
      If that file is the version stamp then this counts the number of commits
      the last version change - a good enough approximation to a CI independent
      build number.
      """
      that_commit = list(
          repo.iter_commits(None, paths=commit_path, max_count=1)
      )[0].hexsha
      this_commit = list(repo.iter_commits())[0].hexsha
      # print('Derive number for commit (of _version.txt): ', that_commit)
      return len(
          list(
              repo.iter_commits(
                  rev="{}^..{}".format(that_commit, this_commit)
              )
          )
      )
  
file_path: nptsne/tools/version_util.py
imports: from pathlib import Path
  import tempfile
  import os
  from git import Repo
label_desc: Use image node_id 4 for calling a global function with example usage: get_git_derived_build_number(repo, commit_path) and returns: len