Callback to be used for getting a version number.

Used by Execute some callback function to get current version versioning schema.


This option is completely ignored if Read some file content as current version or Release is a git tag schemas are used.


str or callable

Default value#


Possible values#

  • None

    Disables this feature

  • function/lambda ( only)

  • function full name in format "some.module:function_name"

    Function should have signature () -> str. It should return version number

  • variable ( only)

  • variable full name in format "some.module:veriable_name"

    Variable should contain str value with version number


If your config file is pyproject.toml you should add this to allow setuptools-git-versioning to access your module source code:

build-backend = "setuptools.build_meta:__legacy__"


If function return value or variable content is not PEP 440 compatible version, the exception will be raised


Exception will also be raised if module or function/lambda/variable is missing