Showing post with tag dependencies . Show all

vagrant 1


by Malik BOUGACHA, EBU on 14 Sep 2013

Developpement sandboxing

Vagrant is a way to sandbox the devloppement environement. I will take python as an example of sandbox and explain how we come from a simple os based devloppement environement and test to a vm env.

machine

Let's start with a simple machine environement

python server.py 

The server.py being a very simple flask server:

from Flask import Flask 

app = Flask() 

if __name__ == "__main__": 
    app.run() 

Great right ?
But what happens if we add more dependencies, for example requests, a python module for doing http request.

from Flask import Flask 
import requests 

app = Flask() 

@app.route("/") 
def main(): 
    return request.get("http://example.com/json").json() 

if __name__ == "__main__": 
    app.run() 

The example is pretty simple right ? What does happen when we want to deploy it ? It will crash depending on the version of the requests module we have. As we have a stable version of debian, we don't have the right version of the library and of course we don't want to install it at a system wide level But there is a solution for this in python: virtualenv.


dependencies python vagrant virtualenv