I need to set versioning in my pythonproject.
Every time I make a release - I merge my production and development branches in my VCS.
I need to make the least amount of corrections in setting up version of the project and automate the process.  
setup.py file in this documentation
django works with its versions here  I need for my release:
So I plan to make my release number format major.minor.changeset, because keeping the release date in the version makes it pretty long.
I want to create version.py file:
MAJOR_VERSION = 1
MINOR_VERSION = 1
RELEASE_DATE = '28 .08.2013 '
def get_revision ():
    ...
def get_version ():
   ....
And import the version from there when I need it (but I'm affraid that someone can forget to set up proper date), and put the file CHANGE.TXT next to it which describes release changes.
I want to know how do you set versions in your python projects and how should I convert my idea to simplify my scheme.
Versioning is the process of adding unique identifiers to different versions of your package. The unique identifier you use may be name-based or number-based, but most Python packages use semantic versioning.
The special variable __version__ is a convention in Python for adding version numbers to your package. It was introduced in PEP 396.
While Python doesn't fully support SemVer, you can still create three-part versions in the same manner. Semantic Versioning works by structuring each version identifier into three parts, MAJOR, MINOR, and PATCH.
Two related issues: (1) what are good choices for metadata to track at the module level, including versioning, plus other useful information; and (2) what is a good way to represent that metadata.
A general approach for module metadata is explained at http://epydoc.sourceforge.net/manual-fields.html#module-metadata-variables.  This basically says, use constants named __author__, __authors__, __contact__, __copyright__, __license__, __date__ and __version__.  These are commonly used, so it's a good convention.
Then for how to populate the __version__ constant -- a good model for versioning anything is semantic versioning -- see http://semver.org/.  Basically, use 1.2.3 style in which major changes only when there's an incompatible API change, minor changes when there's new functionality, and micro aka patch changes when there's a bug fix.  This is also used commonly and therefore a good convention.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With