Skip to main content

Automatically set package version using git tag/hash

Project description

setuptools-git-versioning

PyPI version PyPI - Python Version Build Status

Automatically set package version using git tag/hash

Compairing with other packages

Package/Function Lastest release Python2 support Python3 support PEP 440 compatible Separated template for not tagged HEAD Separated template for dirty run Using functions outside setup.py Returning starting_version if no tags
setuptools-git-versioning 2020 + + + + + + +
setuptools-git-ver (Base package) 2020 - + + + + - -
even-better-setuptools-git-version 2019 - + + - - + +
better-setuptools-git-version 2018 - + + - - + +
very-good-setuptools-git-version 2018 - + - - - + -
setuptools-git-version 2018 + + - - - - -

Installation

No need.

Adding setup_requires=['setuptools-git-versioning'] somewhere in setup.py will automatically download the latest version from PyPi and save it in the .eggs folder when setup.py is run.

Usage

To just use the default templates for versioning:

setuptools.setup(
    ...
    version_config=True,
    ...
    setup_requires=['setuptools-git-versioning'],
    ...
)

Changing templates (also shows the defaults):

setuptools.setup(
    ...
    version_config={
        "template": "{tag}",
        "dev_template": "{tag}.dev{ccount}+git.{sha}"
        "dirty_template": "{tag}.dev{ccount}+git.{sha}.dirty",
        "starting_version": "0.0.1"
    },
    ...
    setup_requires=['setuptools-git-versioning'],
    ...
)

Templates

  • template: used if no untracked files and latest commit is tagged

  • dev_template: used if no untracked files and latest commit isn't tagged

  • dirty_template: used if untracked files exist or uncommitted changes have been made

  • starting_version: static value, used if not tags exist in repo

Format Options

  • {tag}: Latest tag in the repository

  • {ccount}: Number of commits since last tag

  • {sha}: First 8 characters of the sha hash of the latest commit

  • {branch}: Current branch name

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

setuptools-git-versioning-1.1.9.tar.gz (4.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

setuptools_git_versioning-1.1.9-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

setuptools_git_versioning-1.1.9-py2-none-any.whl (5.1 kB view details)

Uploaded Python 2

File details

Details for the file setuptools-git-versioning-1.1.9.tar.gz.

File metadata

  • Download URL: setuptools-git-versioning-1.1.9.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.7

File hashes

Hashes for setuptools-git-versioning-1.1.9.tar.gz
Algorithm Hash digest
SHA256 7ec7bf59653630673fe425f439c3828b9faf032e20811f43921172c80c13ca51
MD5 d736bb9201e7625cfff3655042f93d06
BLAKE2b-256 e7be4c67e49fa044d33e88503fcaad1c1010c4dd8b3b7353d1d213e60588253f

See more details on using hashes here.

File details

Details for the file setuptools_git_versioning-1.1.9-py3-none-any.whl.

File metadata

  • Download URL: setuptools_git_versioning-1.1.9-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.7

File hashes

Hashes for setuptools_git_versioning-1.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 bac565f03e25714e781ec27e945eb9305ea4ab70acc26c9132881bb749d273a5
MD5 ae43e637dfd0f45122c593fba9376609
BLAKE2b-256 aafe38fc7fec02b3c7bf2574d4e7c6569e76835a60d6d70a3cebd48ba915058e

See more details on using hashes here.

File details

Details for the file setuptools_git_versioning-1.1.9-py2-none-any.whl.

File metadata

  • Download URL: setuptools_git_versioning-1.1.9-py2-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/2.7.15

File hashes

Hashes for setuptools_git_versioning-1.1.9-py2-none-any.whl
Algorithm Hash digest
SHA256 ede8f7890c5bee9e84e45e93be9b56729827e50e924a5eab7a418746666d8fe6
MD5 212e843701001b8d311c376a7c56c2e0
BLAKE2b-256 4473a5ee7a63d72206d8c226cc6f6cf18f44c4208eb17e08a456bbee6f17e0ca

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page