Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Making versioning easy

Project Description

Single module python package to make versioning simple. You add a couple of
configuration parameters to your top-most python module and ``whatsmyversion`` will
determine the version string based on your git history.

Using ``whatsmyversion``

Add the following to the top level of your package (package_name/
or ::

import whatsmyversion
__version__ = whatsmyversion.version(__file__)
del whatsmyversion

Add the following to your ::

import package_name

setup = (
version = package_name.__version__

Aaaaand that's it! ::

python -c "import package_name; print(package_name.__version__)"

For example, look at the ```` and ```` of this project for
guidance in setting up your own project! ::

$ python -c "import whatsmyversion; print(whatsmyversion.__version__)"

Configuring ``whatsmyversion``
There are a few configuration options that you can provide to the `version`
function. These are:

``version_prefix`` which is defaults to ``v``

``version_suffix`` which is one of ``a``, ``b``, ``rc``, ``.post``, ``.dev``
and defaults to ``.post``

``use_local_version_id`` which is a boolean flag to include (True) or not
(False) the git hash and defaults to ``True`` because information is power

These three configuration options combine to produce a PEP440 compliant
version string. `PEP440 <>`_

Use cases


* Determine the version of a git repository

* Installed with `` develop``

* Installed with `` install``

Not yet working:

- Determine the version of source code downloaded from github

Release History

This version
History Node


History Node


History Node


History Node


History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Hash SHA256 Hash Help Version File Type Upload Date
(4.4 kB) Copy SHA256 Hash SHA256
Source Sep 8, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting