Skip to main content

Automatically set package version using git tags with semver ordering.

Project description

semver-setuptools-git-version

PackageVersion PythonVersion Stable Format License

Automatically set package version from Git. This is a re-release of better-setuptools-git-version with fixes and improvements for semver ordering, which is itself a re-release of setuptools-git-version

Introduction

Instead of hard-coding the package version in setup.py like:

setup(
    name='foobar',
    version='1.0',
    ...
)

this package allows to extract it from tags in the underlying Git repository:

setup(
    name='foobar',
    version_config={
        "version_format": "{tag}.dev{sha}",
        "starting_version": "0.1.0"
    },
    setup_requires=['semver-setuptools-git-version'],
    ...
)

The tool uses the semantically-latest tag as the base version. If there are no annotated tags, the version specified by starting_version will be used. If HEAD is at the tag, the version will be the tag itself. If there are commits ahead of the tag, the first 8 characters of the sha of the HEAD commit will be included.

In all the above cases, if the working tree is also dirty or contains untracked files, a +dirty suffix will be appended to the version.

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

semver-setuptools-git-version-1.0.0.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file semver-setuptools-git-version-1.0.0.tar.gz.

File metadata

  • Download URL: semver-setuptools-git-version-1.0.0.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.0.1 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for semver-setuptools-git-version-1.0.0.tar.gz
Algorithm Hash digest
SHA256 6bbe8e8a8a3b061371e50422f266589d4d0386406eb92e10e60c6de3a199f272
MD5 3a058ad53c935677bc3efcb68bcd68a8
BLAKE2b-256 10d95d8eea99f58290eaa757b6fb60e053b799adc91537fdbbec089e8731022d

See more details on using hashes here.

File details

Details for the file semver_setuptools_git_version-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: semver_setuptools_git_version-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.0.1 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for semver_setuptools_git_version-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 02786e205fd4e81b0f97d1dbb7bcb1db5ba054cdea72df26217fe573dec72de9
MD5 3419ff1a46df19b861a83d4a2ea09058
BLAKE2b-256 3ee1e9ad4d1ca7cdfe63b4d06562b09fab6795985889cefe52dee2b21547ae32

See more details on using hashes here.

Supported by

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