Created
September 6, 2012 09:54
-
-
Save vicentereig/3654113 to your computer and use it in GitHub Desktop.
Simple .pythonbrewrc implementation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export PYTHONBREW_PROJECT_VENV='your_projects_venv' | |
export PYTHONBREW_PYTHON_VERSION='2.7.3' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/.pythonbrewrc | |
__pythonbrew_init_project() | |
{ | |
pythonbrew switch $PYTHONBREW_PYTHON_VERSION; | |
pythonbrew venv use $PYTHONBREW_PROJECT_VENV; | |
} | |
cd () | |
{ | |
builtin cd "$@"; | |
local result=$?; | |
[[ -s ".pbrc" ]] && source ".pbrc" && __pythonbrew_init_project; | |
return $result | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# It simply switches to the Python version and venv when cd'ing your project directory. | |
# This simple implementation is inspired on RVM's .rvmrc file. https://rvm.io/workflow/rvmrc | |
# 1) Grab a copy of pythonbrew.sh and store it at ~/.pythonbrewrc | |
echo "Downloading .pythonbrewrc..." | |
curl https://raw.github.com/gist/3654113/ee7f60f347cc0576001ece7dfa16b35eca8aa6d7/pythonbrew.sh > ~/.pythonbrewrc | |
# 2) Add the following line to your .bashrc or .bash_profile | |
# [[ -s "$HOME/.pythonbrewrc" ]] && source $HOME/.pythonbrewrc | |
# 3) Assuming your project is under $PROJECT_PATH, create $PROJECT_PATH/.pbrc and edit it to match your needs. | |
echo "Storing .pbrc at $PROJECT_PATH..." | |
curl https://raw.github.com/gist/3654113/97a1f413f0ae655bc4d9b812a9f3fa935bf98578/.pbrc > $PROJECT_PATH/.pbrc | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Installation: