Skip to content

Commit

Permalink
chore: Update .envrc to bootstrap binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
1ambda committed Sep 4, 2023
1 parent 89d288a commit 204e161
Showing 1 changed file with 44 additions and 17 deletions.
61 changes: 44 additions & 17 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,41 +1,68 @@
use_python() {
if [ -n "$(which pyenv)" ]; then
local pyversion=$1
pyenv local ${pyversion}
fi
if [ -n "$(which pyenv)" ]; then
local pyversion=$1
pyenv local ${pyversion}
fi
}

layout_virtualenv() {
local pyversion=$1
local pvenv=$2
if [ -n "$(which pyenv virtualenv)" ]; then
pyenv virtualenv --force --quiet ${pyversion} ${pvenv}-${pyversion}
fi
pyenv local --unset
local pyversion=$1
local pvenv=$2
if [ -n "$(which pyenv virtualenv)" ]; then
pyenv virtualenv --force --quiet ${pyversion} ${pvenv}-${pyversion}
fi
pyenv local --unset
}

layout_activate() {
if [ -n "$(which pyenv)" ]; then
source $(pyenv root)/versions/$1/bin/activate
fi
if [ -n "$(which pyenv)" ]; then
source $(pyenv root)/versions/$1/bin/activate
fi
}

# Setup Python
pyversion=3.10.13
pvenv=lakehouse

# Setup Python
TAG="direnv"

if ! [ -x "$(command -v pyenv)" ]; then
echo -e "${TAG} Installing brew CLI: pyenv, virtualenv"
brew install pyenv
brew install pyenv-virtualenv
fi

if pyenv versions | grep -q ${pyversion}; then
echo -e ""
echo -e "${TAG} Skip installing python ${pyversion}"
echo -e ""
else
echo -e ""
echo -e "${TAG} Installing pyenv python ${pyversion}"
echo -e ""
pyenv install ${pyversion}
fi

# Activate Environment
echo -e "${TAG} Activating pyenv virtualenv ${pvenv}-${pyversion}"
use python ${pyversion}
layout virtualenv ${pyversion} ${pvenv}
layout activate ${pvenv}-${pyversion}
if ! [ -x "$(command -v poetry)" ]; then
pip3 install poetry
pip install --upgrade pip
fi

# Install Dependencies
echo -e "${TAG} Installing poetry dependencies"
poetry install

# Setup Git
echo -e "${TAG} Installing pre-commit dependencies"
pre-commit install


# Start
echo -e ""
echo -e ""
echo -e "[direnv] Lakehouse environment is ready"
echo -e "${TAG} Lakehouse environment is ready"
echo -e ""
echo -e ""

0 comments on commit 204e161

Please sign in to comment.