Most viewed recipes tagged "versioning"http://code.activestate.com/recipes/tags/versioning/views/2008-09-17T11:25:48-07:00ActiveState Code RecipesVersion-specific import (Python) 2008-09-17T11:25:48-07:00Michaelhttp://code.activestate.com/recipes/users/4166101/http://code.activestate.com/recipes/576508-version-specific-import/ <p style="color: grey"> Python recipe 576508 by <a href="/recipes/users/4166101/">Michael</a> (<a href="/recipes/tags/import/">import</a>, <a href="/recipes/tags/versioning/">versioning</a>, <a href="/recipes/tags/versions/">versions</a>). Revision 5. </p> <p>Let's say you're at a company and you're deploying a package called "tools" on all production boxes. Normally, code on these boxes could "import tools" to use this package.</p> <p>However, over time the API to tools will evolve as you release new versions that add functionality and fix bugs. If there's lots of company code that "imports tools", then you're stuck with backward compatibility forever.</p> <p>This recipe presents a method for letting client code specify on one line which version of "tools" they wish to use -- and then import from the tools package as normal. Behind the scenes, the recipe is making sure that the client works with the version of the package that they requested. If the client ever wants to change versions, it's a one-line change at the top of their code.</p>