Install#
pyproject.toml
#
Just add setuptools-git-versioning
to build-sytem
section of your pyproject.toml
,
add a section tool.setuptools-git-versioning
with config options, and mark the project
version
as dynamic.
[build-system]
requires = [ "setuptools>=41", "wheel", "setuptools-git-versioning>=2.0,<3", ]
build-backend = "setuptools.build_meta"
[tool.setuptools-git-versioning]
enabled = true
[project]
dynamic = ["version"]
And check the package version generated (see command help):
$ python -m setuptools_git_versioning
0.0.1
# or
$ setuptools-git-versioning
0.0.1
setup.py
#
Just add setuptools-git-versioning
to setup_requires
argument of setuptools.setup
function call,
and then add new argument setuptools_git_versioning
with config options:
import setuptools
setuptools.setup(
...,
setuptools_git_versioning={
"enabled": True,
},
setup_requires=["setuptools-git-versioning>=2.0,<3"],
)
And check the package version generated (see command help):
$ python setup.py --version
0.0.1
# or
$ python -m setuptools_git_versioning
0.0.1
# or
$ setuptools-git-versioning
0.0.1