Search code examples
pythongitreleasesetup.pypypi

Releasing for Python (with pbr): version not generated


This is something I am new to, but I made a small Python library on Github and looking to release it on PyPI. The pbr library is supposed to make things easier by taking versions from git tags, etc.

However, pbr is not deriving the version number from the git tag.

Here is what I tried:

  • Push code to Github and create a release with semantic tagname v1.0.0
  • Make sure the tag is also in my local repository: git fetch --tags
  • Generate and upload a release: python setup.py sdist upload -r pypi

The release is made and pbr seems to works fine, only the version number is 0.0.1.dev2. The last number seems to increase with the number of commits.

I have tried to explicitly checkout the revision at the tag: git checkout tags/v1.0.1, but that made no difference.

Why is pbr not following my Git tags?

edit: this is the code on Github


Solution

  • Note: pbr expects Git tags to be signed for use in calculating versions.

    See https://docs.openstack.org/pbr/latest/user/features.html#version

    You have to sign you tags with GPG:

    git tag -s $version