-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Update .envrc to bootstrap binaries
- Loading branch information
Showing
1 changed file
with
44 additions
and
17 deletions.
There are no files selected for viewing
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
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 "" |