This smells a bit like an
XY Problem - what is the original problem that led you to the requirement of setting the version number dynamically? Also, it is not clear which version number you are talking about, is it the version number of the module (in which case setting it dynamically is usually not a good idea unless you can explain exactly why you need to), or are you talking about some other version number?