Post release#

For example, current repo state is:

commit 64e68cd4 Current commit (HEAD, master)
|
commit 86269212 Release commit (v1.0.0)
|
commit e7bdbe51 Another commit
|
...
|
commit 273c47eb Long long ago
|
...

And you want to generate post versions for every commit after release tag.

Just install setuptools-git-versioning and then your package version will be 1.0.0.post1+git.64e68cd4.

Version number template#

Sometimes you want see just 1.0.0.post1 value or even 1.0.0.

To get version in such a format you can set a template in the config file:

import setuptools

setuptools.setup(
    ...,
    setup_requires=["setuptools-git-versioning>=2.0,<3"],
    setuptools_git_versioning={
        "enabled": True,
        "dev_template": "{tag}.post{ccount}",  # <---
    },
)

See also#