Skip to content

Vitural Environments

Overview

Benefit:

  • Seperated environment to develop per project

  • Diffents dependencies

setup.sh
#!/bin/bash

# Configuration

# Vitural environment
declare VITURAL_ENV=venv

# Python Execution, $(which py)
declare PY_CMD=python

echo -e "\e[34m[1] Create requirement folders:\e[0m";
for fold in logs outputs temp $VITURAL_ENV
do
    if [ ! -d $fold ];
    then
        mkdir $fold;
        echo -e "\e[32mCreated $fold folder\e[0m";
    else
        echo -e "\e[32m$fold has been established\e[0m";
    fi;
done;

echo -e "\e[34mEstablished platform compatible\e[0m";
case "$OSTYPE" in
    msys*)
        echo "OS: Window >"
        declare PY_CMD=python
        declare ACTIVATE_DIR=Scripts
    ;;
    linux*)
        echo "OS: Linux >"
        declare PY_CMD=python3
        declare ACTIVATE_DIR=bin
    ;;
    *)
        echo "Not supported for this os: '$OSTYPE'"
    ;;
esac

# [Off] When build successful #!/bin/python3
# echo -e "\e[34mSet up vitural environment at \e[30m'$VITURAL_ENV'\e[0m\e[0m";
# $PY_CMD -m venv $VITURAL_ENV;

# echo -e "\e[34mActivate environment\e[0m";
# source $VITURAL_ENV/$ACTIVATE_DIR/activate;

echo -e "\e[34mUpgrade PIP version ...\e[0m";
$PY_CMD -m pip install --upgrade pip;

echo -e "\e[34mInstall requirements packages:\e[0m";
cat requirements.txt;
$PY_CMD -m pip install -r requirements.txt;

for pkg in httr sys_metadata utils_mysql
do
    cd $(pwd)/src/$pkg;
    $PY_CMD -m pip install . --force-reinstall;
    cd ../../
done;
#!/bin/bash

declare VENV=venv;

case "$OSTYPE" in
    msys*)
        declare ACTIVATE_DIR=Scripts
    ;;
    linux*)
        declare ACTIVATE_DIR=bin
    ;;
    *)
        echo "Not supported for this operating system type: '$OSTYPE'"
    ;;
esac;

source $VENV/$ACTIVATE_DIR/activate;

Reference