Automatically set package version from Git.
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.
setuptools-git-version
provides three fields as options for the version_format
string:
tag
: The latest tag (probably a release version likev1.0.3
) in your repositorycommitcount
: 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
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
- [feature] allow to build a package using a git-based version without modifying it upfront
- [bugfix] rename module to avoid import conflicts
- [bugfix] make it work with Python 3(.4)
- brownbag release
- initial public release