Google App Engine VirtualEnv Tool that is not virtualenv for Python
When I build app engine projects and I want to include python package, what I do is download the source and symlink/include it in the project. I have tried the virtualenv approach but it didn't feel clean and I couldn't find anything that will suit my needs in a simple way. So I created this new tool called gaenv which will automate installation/linking of your installed packages to your gae project, it doesn't really need to be a gae project since what it does is just create a folder of symlinks following your requirements.txt so this can be useful to any container base deployment packages that follows symbolic links.
Installation & usage:
That's it, this should create a folder named gaenv_lib on the same path you execute it on and if you said "y" on the detect insert import it will look into your app.yaml and try to add import gaenv_lib before any other import happens. You should just do it manually if you have complex setup on your project, what it basically does is simply add gaenv_lib in sys.path. To overwrite those names you can check with gaenv -h
To people that haven't experienced using requirements.txt it's basically a list of your python packages per line. Then using pip install -r requirements.txt just install them all. gaenv follows the same format. Here is a sample:
You can download and install manually at
https://pypi.python.org/pypi/gaenv
it's also on github at
https://github.com/faisalraja/gaenv
Hope someone finds it useful as I did. Enjoy.
Also note that this shouldn't stop you from using virtualenv with all your gae compatible packages then just run install gaenv on that virtualenv and run the binary from it's bin folder, this way you just maintain one virtualenv.
Installation & usage:
# Note that if you install on a system with multiple python, # you need to call the correct binary on which it looks up packages $ sudo pip install gaenv $ cd to/your/gae-project # Create your requirements.txt & run this to install it $ pip install -r requirements.txt $ gaenv
That's it, this should create a folder named gaenv_lib on the same path you execute it on and if you said "y" on the detect insert import it will look into your app.yaml and try to add import gaenv_lib before any other import happens. You should just do it manually if you have complex setup on your project, what it basically does is simply add gaenv_lib in sys.path. To overwrite those names you can check with gaenv -h
To people that haven't experienced using requirements.txt it's basically a list of your python packages per line. Then using pip install -r requirements.txt just install them all. gaenv follows the same format. Here is a sample:
boto>=2.8.5 peewee flask==0.9
You can download and install manually at
https://pypi.python.org/pypi/gaenv
it's also on github at
https://github.com/faisalraja/gaenv
Hope someone finds it useful as I did. Enjoy.
Also note that this shouldn't stop you from using virtualenv with all your gae compatible packages then just run install gaenv on that virtualenv and run the binary from it's bin folder, this way you just maintain one virtualenv.
Comments
Post a Comment