Skip to content

Instantly share code, notes, and snippets.

@anqxyr
Last active January 9, 2018 14:44
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anqxyr/56ab72982bbbcd8cdfb4 to your computer and use it in GitHub Desktop.
Save anqxyr/56ab72982bbbcd8cdfb4 to your computer and use it in GitHub Desktop.
Python: automagically increment version with commit count
import setuptools
import subprocess
major_version = '1.4'
commits = commits = subprocess.check_output(
['/usr/bin/git', 'rev-list', 'HEAD', '--count']).decode('utf8').strip()
kwargs = {} # you know what to put here
setuptools.setup(
version='{}.{}'.format(major_version, commits),
**kwargs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment