Is there a standard way to associate version string with a python package in such way that I could do the following?
Not directly an answer to your question, but you should consider naming it
This is almost a quasi-standard. Many modules in the standard library use
__version__, and this is also used in lots of 3rd-party modules, so it's the quasi-standard.
__version__ is a string, but sometimes it's also a float or tuple.
Edit: as mentioned by S.Lott (Thank you!), PEP 8 says it explicitly:
If you have to have Subversion, CVS, or RCS crud in your source file, do it as follows.
__version__ = "$Revision: 63990 $" # $Source$
These lines should be included after the module's docstring, before any other code, separated by a blank line above and below.