Use git repo data for building a version number according PEP-440
Project description
Use git repo data (latest tag, current commit hash, etc) for building a version number according PEP 440.
Features:
Can be installed & configured through both setup.py and PEP 518’s pyproject.toml
Does not require to change source code of the project
Tag-, file-, and callback-based versioning schemas are supported
Templates for tag, dev and dirty versions are separated
Templates support a lot of substitutions including git and environment information
Well-documented
See difference between setuptools-git-versioning and other tools.
Limitations:
Currently the only supported VCS is Git
Only git v2 is supported
Currently does not support exporting version to file for runtime use
Documentation
See https://setuptools-git-versioning.readthedocs.io/en/stable/
Contribution Guide
See ./CONTRIBUTING.rst
Install
pyproject.toml
Just add setuptools-git-versioning to build-sytem section of your pyproject.toml, and a section tool.setuptools-git-versioning with config options:
[build-system]
requires = [ "setuptools>=41", "wheel", "setuptools-git-versioning", ]
build-backend = "setuptools.build_meta"
[tool.setuptools-git-versioning]
enabled = true
And check the package version generated:
$ 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"],
)
And check the package version generated:
$ python setup.py --version
0.0.1
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for setuptools-git-versioning-1.10.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a68f2cd6d261503750fe600ba3c533440c57c1801ed743175c387e9b3e80f44e |
|
MD5 | 467288fb5e4d8482720cdc79ee8afcd1 |
|
BLAKE2b-256 | be988abd8fea9b5a916c48a6dca8a88be66b99705fe7e92c13ea262e4e50c4a1 |
Hashes for setuptools_git_versioning-1.10.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46fb53112e84d8eb565e065a01f1aae2f74d5deb4f1b92eaa3b8dab152567e98 |
|
MD5 | f8ea74682437d2b6a30b05ca6d25cac5 |
|
BLAKE2b-256 | e4ebdbab3694548d9439c6485b543846572c61c866b849c76114e9f7fef81244 |