diff options
| author | Franck Cuny <franckcuny@gmail.com> | 2016-07-31 10:16:40 -0700 |
|---|---|---|
| committer | Franck Cuny <franckcuny@gmail.com> | 2016-07-31 13:42:48 -0700 |
| commit | 63f413891d5adc596e4d51dfba4d0d23fdea3ca4 (patch) | |
| tree | c2726b60515057a20f434bd89c596360ef17852b /content/post/2012-10-31-virtualenv-and-checkouts.md | |
| parent | Add Google Analytic tracker. (diff) | |
| download | lumberjaph-63f413891d5adc596e4d51dfba4d0d23fdea3ca4.tar.gz | |
Stop generating a static site.
Diffstat (limited to 'content/post/2012-10-31-virtualenv-and-checkouts.md')
| -rw-r--r-- | content/post/2012-10-31-virtualenv-and-checkouts.md | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/content/post/2012-10-31-virtualenv-and-checkouts.md b/content/post/2012-10-31-virtualenv-and-checkouts.md deleted file mode 100644 index 81b11e9..0000000 --- a/content/post/2012-10-31-virtualenv-and-checkouts.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -date: 2012-10-31T00:00:00Z -summary: In which I share a trick for virtualenv -title: Virtualenv and checkouts ---- - -I've started to do some Clojure in my spare time. The default tool adopted by the community to manage projects is [leiningen](http://leiningen.org). For those of you who don't know what `lein` is, it's a tool to automate your Clojure project: it will boostrap a new project, install the dependencies, and there's a plugin mechanism to extend the default possibilities of the tool. - -One of the nice feature of the tool is the **checkouts** directory. From the [FAQ](https://github.com/technomancy/leiningen/blob/preview/doc/FAQ.md): - -> If you create a directory named checkouts in your project root and symlink some other project roots into it, Leiningen will allow you to hack on them in parallel. - -For Python projects at [$work](http://www.saymedia.com/careers) I use [virtualenvwrapper](http://virtualenvwrapper.readthedocs.org/en/latest/) to easily work on them without having to deal with conflicting dependencies. When I need to change a library that is used by one of the project, usually I go to the virtualenv directory and create a symlink so it uses the one I'm editing. - -What I really want is a mechanism similar to `lein`, where I can have a **checkouts/** directory inside the main project, where I can clone a library or create a symlink. Since `virtualenvwrapper` provides a hook mechanism, I wrote a small hook inside **~/.virtualenvs/postactivate**: - -```sh -#!/bin/bash - -# move to the directory of the project -proj_name=$(echo $VIRTUAL_ENV|awk -F'/' '{print $NF}') -proj_path=/home/vagrant/src/$proj_name - -cd $proj_path - -if [ -d checkouts ]; then - for ext in $(ls checkouts); do - export PYTHONPATH=proj_path/checkouts/$ext:$PYTHONPATH - done -fi -``` - -Then, when I type `workon $project_name` in my shell, the environment is activated, I'm moved to the right directory, and the library inside the **checkouts/** directory are added to my **PYTHONPATH**. |
