1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- alias py='python'
- alias pyfind='find . -name "*.py"'
- function pyclean() {
- ZSH_PYCLEAN_PLACES=${*:-'.'}
- find ${ZSH_PYCLEAN_PLACES} -type f -name "*.py[co]" -delete
- find ${ZSH_PYCLEAN_PLACES} -type d -name "__pycache__" -delete
- find ${ZSH_PYCLEAN_PLACES} -depth -type d -name ".mypy_cache" -exec rm -r "{}" +
- find ${ZSH_PYCLEAN_PLACES} -depth -type d -name ".pytest_cache" -exec rm -r "{}" +
- }
- function pyuserpaths() {
- local targets=("python2" "python3")
-
-
- local interps=()
- for target in $targets; do
- [ `command -v $target` ] && interps+=($target)
- done
-
- local user_base="${HOME}/.local"
- [ $PYTHONUSERBASE ] && user_base=$PYTHONUSERBASE
-
-
-
- for interp in $interps; do
-
- local ver=`$interp -V 2>&1`
- ver=`echo ${ver:7} | cut -d '.' -f 1,2`
-
- local site_pkgs="${user_base}/lib/python${ver}/site-packages"
- [[ -d $site_pkgs && ! $PYTHONPATH =~ $site_pkgs ]] && export PYTHONPATH=${site_pkgs}:$PYTHONPATH
- done
- }
- alias pygrep='grep -nr --include="*.py"'
- alias ipython="python -c 'import IPython; IPython.terminal.ipapp.launch_new_instance()'"
|