Skip to content

Instantly share code, notes, and snippets.

@e3krisztian
Created April 16, 2015 14:00
Show Gist options
  • Select an option

  • Save e3krisztian/65a15315dccd8ba5e7e2 to your computer and use it in GitHub Desktop.

Select an option

Save e3krisztian/65a15315dccd8ba5e7e2 to your computer and use it in GitHub Desktop.
pyd - give Python development shell with required packages already installed
#!/bin/bash
[ -e test-requirements.txt ] && {
echo 'Entering Python environment as defined by test-requirements.txt'
exec in-virtualenv -r test-requirements.txt /bin/bash "$@"
}
[ -e test_requirements.txt ] && {
echo 'Entering Python environment as defined by test_requirements.txt'
exec in-virtualenv -r test_requirements.txt /bin/bash "$@"
}
[ -e requirements.txt ] && {
echo 'Entering Python environment as defined by requirements.txt'
exec in-virtualenv /bin/bash "$@"
}
[ -e setup.py ] && {
echo 'Entering Python environment as defined by setup.py'
TMPREQ="$(mktemp)"
echo '-e .' > "$TMPREQ"
(sleep 2; rm "$TMPREQ") &
exec in-virtualenv -r "$TMPREQ" --no-cache /bin/bash "$@"
}
echo 'Using default Python'
exec /bin/bash "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment