How to structure Python code to support multiple releases of MY project (i.e. not multiple versions of Python)
Your subprocess offers an API to the web sites.
The trick is to make it so that API v2 of the subprocess code can handle calls from both v1 and v2 web sites. This is called backward compatibility.
Also, it's nice if the v1 web site is not too picky about the data it receives and can for instance handle a v2 answer from the subprocess that has more information than it used to have in v1. This is called forward compatibility. Json and xml are good ways to achieve it, since you can add properties and attributes at will without harming the parsing of the old properties.
So the solution, I think, does not lie in a python trick, but in careful design of the API of your subprocess such that the API will not break as the subprocess's functionality increases.
I'm working on the back end of a web-based system.  My code will receive calls from our web site and perform the actions requested by the user.  We would like to support multiple versions of our front end simultaneously.  So, for example, I might receive a request from V1 of our front end or from V2 of it.  I need to respond to either of these calls.
As you might expect, a lot of my code will be the same across versions.  For example, my function *get_list_access_params()*  will probably appear in both V1 and V2 (although there may be some changes to the code in it).  My listener should grab the request, figure out which version of our system the call came from and, then, call the right version of *get_list_access_params()*.
My hope is to not have to duplicate and rename the function as v1_get... and v2_get... but, rather, to duplicate the function in two code files, a v1 file and a v2 file.
This must be a common need but I can't figure out where to look for the answer.  Does anyone have a quick answer or can you direct me to a simple place to find it (I am a Python novice, BTW)?  Thank you!