Files
tycho-protocol-sdk/testing/setup_env.sh
Zizou 98c63c685f refactor: stop using private pypi (#132)
* refactor: stop using private pypi

This was required because our repos were not public. Now that they are, people can directly access our Python packages and therefore they don't need access to our private codeartifact anymore

* docs: add a list of dependencies in the readme and early check in the setup env script

---------

Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
2025-01-16 09:07:57 +00:00

48 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
command_exists() {
command -v "$1" >/dev/null 2>&1
}
# Map of dependencies to their binaries (used to check if they are installed)
declare -A dependencies=(
["git"]="git"
["rust"]="rustc"
["gcc"]="gcc"
["openssl"]="openssl"
["pkg-config"]="pkg-config"
["conda"]="conda"
["pip"]="pip"
["libpq"]="pg_config"
)
# Check each dependency
for dep in "${!dependencies[@]}"; do
binary=${dependencies[$dep]}
if ! command_exists "$binary"; then
echo "Error: '$dep' is not installed."
exit 1
fi
done
echo "All dependencies are installed. Proceeding with setup..."
# Variables
ENV_NAME="tycho-protocol-sdk-testing"
PYTHON_VERSION="3.9"
REQUIREMENTS_FILE="requirements.txt"
# Create conda environment
echo "Creating conda environment ${ENV_NAME} with Python ${PYTHON_VERSION}..."
conda create --name $ENV_NAME python=$PYTHON_VERSION -y
# Activate the environment
echo "Activating the environment..."
source activate $ENV_NAME
# Install the requirements
echo "Installing the requirements from ${REQUIREMENTS_FILE}..."
pip install -r $REQUIREMENTS_FILE --index-url https://pypi.org/simple
conda activate $ENV_NAME
echo "Setup complete."