Skip to content

Latest commit

 

History

History
83 lines (50 loc) · 1.85 KB

README.rst

File metadata and controls

83 lines (50 loc) · 1.85 KB

setuptools-git-version

Automatically set package version from Git.

Introduction

Instead of hardcoding the package version in setup.py like:

setup(
    name='foobar',
    version='1.0',
    ...)

this package allows to extract it from the underlying Git repository:

setup(
    name='foobar',
    version_format='{tag}.dev{commitcount}+{gitsha}',
    setup_requires=['setuptools-git-version'],
    ...)

Please ensure that your git repository has at least one annotated tag, as setuptools-git-version will uses tags to determine your current git version.

Fields

setuptools-git-version provides three fields as options for the version_format string:

  • tag: The latest tag (probably a release version like v1.0.3) in your repository
  • commitcount: The number of additional commits on top of this tag (e.g. 13)
  • gitsha: An abbreviated commit hash of the latest commit in your repository

Implementation Details

setuptools-git-version uses the following git command to obtain commit information:

git describe --tags --long --dirty

To ensure that setuptools-git-version is compatible with your project, please ensure this command runs correctly in your repository

Changes

1.0.4 - 2016-06-22

  • [feature] allow to build a package using a git-based version without modifying it upfront

1.0.3 - 2015-04-23

  • [bugfix] rename module to avoid import conflicts

1.0.2 - 2015-04-14

  • [bugfix] make it work with Python 3(.4)

1.0.1 - 2015-04-14

  • brownbag release

1.0 - 2015-04-10

  • initial public release