Python: Best practice for including a version number in an app?
- by Ben
I have a PyQt application that reads and writes data files. I am including a 'version number' in each file written. This is a simple number similar to: 1.2 or something (major and minor versions).
I am doing this so that I can change the format of these data files in future versions and then still correctly parse them simply by checking to see what the version is inside the file.
My question is what is the best practice for keeping this number stored inside the app itself. I.e. do I just hard-code the app version number into the class that is responsible for reading and writing files? Or should I have some sort of object/variable stored at the top-level of the app and somehow access it from the class responsible for reading and writing these files. If the latter, how do I store it and how do I access it?
Thanks.