Welcome to version.py’s documentation!

Version: 0.2

Documentation Status

Documentation: https://versionpy.readthedocs.io

Source: https://github.com/gregschmit/version.py

PyPI: https://pypi.org/project/version-py/

The Problem: Versioning Python packages can be a pain in the ass, especially when building distributions.

The Solution: Include this script and hook it into your setup.py workflow and when you do setup.py sdist bdist_wheel, versioning will be automatically included in your distributions and the get_version hook is smart enough to look for the VERSION_STAMP first before trying to get the version from git.


pip install version-py


To start versioning at 0.1.x, just do git tag -a v0.1 -m 'version 0.1'. Each commit will increment the PATCH level by 1 according to this module’s get_version(). When you want to increment the MINOR, just do git tag -a v0.2 -m 'version 0.2'.

In your setup.py you should stamp the directory so when you generate your package sdist/bdist, the VERSION_STAMP exists (since your sdist/bdist won’t have the .git directory telling the user which version they have):

from my_module_name import version


You should also get the version from get_version and ensure your VERSION_STAMP gets included in your sdists/bdists, like:

    package_data={'my_module_name': ['VERSION_STAMP']},

At the end of your setup.py you should un-stamp the directory:


Finally, source distributions don’t listen to package_data instructions, so you need to include the following in a MANIFEST.in file in the same directory as setup.py:



Email gschmi4@uic.edu if you want to contribute. You must only contribute code that you have authored or otherwise hold the copyright to, and you must make any contributions to this project available under the MIT license.

To collaborators: don’t push using the --force option.