Skip to content
This repository has been archived by the owner on Sep 6, 2024. It is now read-only.

thelabnyc/python-versiontag

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

python-versiontag

What?

This is an ultra-simple library design to make accessing the current version number of your software easy.

Why?

Version numbers are all too often duplicated among setup.py, git tags, and others sources of truth. This library makes it possible to consolidate on git tags as a single source of truth regarding version numbers.

How?

Install python-versiontag using pip.

pip install versiontag

Add version.txt to your .gitignore file.

echo "version.txt" >> .gitignore

Add versiontag to your package's setup.py file.

from versiontag import get_version, cache_git_tag

# This caches for version in version.txt so that it is still accessible if
# the .git folder disappears, for example, after the slug is built on Heroku.
cache_git_tag()

setup(name='My Package',
      version=get_version(pypi=True),
...

Use versiontag where ever you want to access the version number.

>>> from versiontag import get_version
>>> print( get_version() )
'r1.2.3'