added .envrc-python
34599ce1
Hari Sekhon
committed
1 changed file
.envrc-python
/.envrc-python+44
/.envrc-python
Add comment 1 Plus  #!/usr/bin/env bash
Add comment 2 Plus  # vim:ts=4:sts=4:sw=4:et
Add comment 3 Plus  #
Add comment 4 Plus  # Author: Hari Sekhon
Add comment 5 Plus  # Date: Mon Feb 22 17:42:01 2021 +0000
Add comment 6 Plus  #
Add comment 7 Plus  # https://github.com/HariSekhon/SQL-scripts
Add comment 8 Plus  #
Add comment 9 Plus  # License: see accompanying Hari Sekhon LICENSE file
Add comment 10 Plus  #
Add comment 11 Plus  # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish
Add comment 12 Plus  #
Add comment 13 Plus  # https://www.linkedin.com/in/HariSekhon
Add comment 14 Plus  #
Add comment 15 Plus  
Add comment 16 Plus  # ============================================================================ #
Add comment 17 Plus  # P y t h o n D i r E n v
Add comment 18 Plus  # ============================================================================ #
Add comment 19 Plus  
Add comment 20 Plus  # .envrc to auto-load the virtualenv inside the 'venv' directory if present
Add comment 21 Plus  
Add comment 22 Plus  # https://direnv.net/man/direnv-stdlib.1.html
Add comment 23 Plus  
Add comment 24 Plus  set -euo pipefail
Add comment 25 Plus  [ -n "${DEBUG:-}" ] && set -x
Add comment 26 Plus  #srcdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
Add comment 27 Plus  
Add comment 28 Plus  # this is necessary because newer versions of pip no longer allow you to install PyPI packages in system-packages by default
Add comment 29 Plus  for venv in "$PWD/venv" "$HOME/venv"; do
Add comment 30 Plus   if [ -f "$venv/bin/activate" ]; then
Add comment 31 Plus   echo
Add comment 32 Plus   echo "Virtualenv directory found in: $venv"
Add comment 33 Plus   echo
Add comment 34 Plus   echo "Activating Virtualenv inside the directory: $venv"
Add comment 35 Plus  
Add comment 36 Plus   # shellcheck disable=SC1091
Add comment 37 Plus   source "$venv/bin/activate"
Add comment 38 Plus   break
Add comment 39 Plus   fi
Add comment 40 Plus  done
Add comment 41 Plus  
Add comment 42 Plus  # read .env too
Add comment 43 Plus  #dotenv
Add comment 44 Plus