Skip to content

Instantly share code, notes, and snippets.

@pwithnall
pwithnall / version.py
Last active February 28, 2024 13:07 — forked from Changaco/version.py
Extract Python module version from git tags and repository status
# This program is placed into the public domain.
"""
Gets the current version number.
If in a git repository, it is the current git tag.
Otherwise it is the one contained in the PKG-INFO file.
To use this script, simply import it in your setup.py file
and use the results of get_version() as your package version: