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.13.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.13-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

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

Uploaded Python 2

File details

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

File metadata

  • Download URL: setuptools-git-versioning-1.1.13.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.7.1

File hashes

Hashes for setuptools-git-versioning-1.1.13.tar.gz
Algorithm Hash digest
SHA256 99bee8aa3767d236057fa195959280facbf321d819998b6bd6667bc0d16ae0db
MD5 7d317092d6e6c3a4d06122425a29989a
BLAKE2b-256 dbefe8fa99c0ebf864550450817791b9725a7e6feefb4b34a4bbf45c5a13b22f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: setuptools_git_versioning-1.1.13-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.7.1

File hashes

Hashes for setuptools_git_versioning-1.1.13-py3-none-any.whl
Algorithm Hash digest
SHA256 396c343e1cb0101aadead622eb042f3c05624685dd05f0a4338bad4a2437752d
MD5 d619abb6d125541214fada05a7b01a66
BLAKE2b-256 9bbff84d76a19e8afb40bd29437a330570f36bda4de47145d3ee13d7d3604c67

See more details on using hashes here.

File details

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

File metadata

  • Download URL: setuptools_git_versioning-1.1.13-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.13-py2-none-any.whl
Algorithm Hash digest
SHA256 00052496e520793545a49cfdfcd5232fbfb0b7ecef2045bf72fcd15568cddcf2
MD5 9e52719a1f43f5c323252a6a61aa638d
BLAKE2b-256 4526e6af9b68f2af7d399d41b1c4e2db1500e6d257562553bbe2886e3ef2d358

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