As heavy python users it’s almost impossible to setup different environments without the use of virtualenv. As we move more of our existing systems to the ShareThis systems team, our packaging and deployments requirements change. One of those changes is that the package must be deployable to different system paths.  This is because the systems team might change the path based on their own internal requirements like OS changes or even datacenter changes they might have to make.

In order to accommodate this requirement we had to make use of virtualenv’s “–relocatable” flag.  This flag lets virtualenv know not to make paths absolute and will re-write any absolute paths to use relative paths instead.   This flag is currently experimental so we had to make sure that the changes didn’t break anything.  Fortunately we were able to leverage our testing infrastructure, which has unit and integration tests, to make sure that nothing was broken.  Using that flag we’re able to install all our packages using pip and a requirements file.  Once we confirmed that all worked with the –relocatable flag we moved it into production.  All is working well and we’re able to deploy fully relocatable python packages where the developers can manage the python package dependencies without requiring the systems team to get involved.  Hope this helps!

Leave a Reply