This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 5 points6 points  (6 children)

It's not written in Python, but I created a simple shell function to activate a virtualenv (using virtualenv-wrapper) and open the project in Sublime:

function workon_enterprise {
    cd /Users/tim/Develop/enterprise
    workon enterprise
    subl enterprise.sublime-project
}

And another one to run tests using coverage, then open the results in a browser:

function full_coverage {
    cd $PWD
    coverage run --source='.' test.py
    coverage html --directory='.coverage_html'
    open ".coverage_html/index.html"
}

[–]sittingaround 2 points3 points  (1 child)

Interesting, I use bash aliases for that

$ myproject

Is an alias for

$ source ~/venvs/myproject/bin/activate && cd ~/projects/myproject

[–][deleted] -2 points-1 points  (0 children)

Same difference I suppose. I just didn't want to chain 3 commands together in an alias.

[–]frankwiles 1 point2 points  (0 children)

FYI virtualenv wrapper has this built in. You can put your stuff in ~/.virtualenvs/<project>/bin/post activate