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>
This commit is contained in:
@@ -11,5 +11,5 @@ To generate the rust structs run the following command from within the root
|
||||
directory:
|
||||
|
||||
```bash
|
||||
buf generate --template substreams/crates/tycho-substreams/buf.gen.yaml --output substreams/crates/tycho-substreams/
|
||||
buf generate --template substreams/crates/tycho-substreams/buf.gen.yaml --output substreams/crates/tycho-substreams/
|
||||
```
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
export RPC_URL=https://mainnet.infura.io/v3/your-infura-key
|
||||
export SUBSTREAMS_API_TOKEN="changeme"
|
||||
export DOMAIN_OWNER="AWSAccountId"
|
||||
|
||||
@@ -36,21 +36,22 @@ The script to generate this file manually is available under `evm/scripts/buildR
|
||||
|
||||
## Setup testing environment
|
||||
|
||||
### Step 1: Export Environment Variables
|
||||
## Prerequisites
|
||||
|
||||
**DOMAIN_OWNER**
|
||||
Before setting up the Python environment, ensure the following tools and libraries are installed on your system:
|
||||
|
||||
- **Description**: The domain owner identifier for Propellerhead's AWS account, used for authenticating on the private
|
||||
PyPI repository.
|
||||
- **Example**: `export DOMAIN_OWNER=123456789`
|
||||
- **Git**: Version control tool (https://git-scm.com/)
|
||||
- **Rust**: Programming language and toolchain (https://www.rust-lang.org/)
|
||||
- **GCC**: GNU Compiler Collection (https://gcc.gnu.org/)
|
||||
- **libpq**: PostgreSQL client library (https://www.postgresql.org/docs/9.5/libpq.html)
|
||||
- **OpenSSL (libssl)**: OpenSSL development library (https://github.com/openssl/openssl)
|
||||
- **pkg-config**: Helper tool for managing compiler flags (https://www.freedesktop.org/wiki/Software/pkg-config/)
|
||||
- **Conda**: Python package manager (https://docs.conda.io/en/latest/)
|
||||
- **pip**: Python package installer (https://pip.pypa.io/)
|
||||
|
||||
### Step 2: Create python virtual environment for testing
|
||||
|
||||
Run setup env script. It will create a conda virtual env and install all dependencies.
|
||||
Run the setup env script. It will create a conda virtual env and install all dependencies.
|
||||
This script must be run from within the `tycho-protocol-sdk/testing` directory.
|
||||
|
||||
Please note that some dependencies require access to our private PyPI repository.
|
||||
|
||||
```
|
||||
setup_env.sh
|
||||
```
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Enable automatic export of all defined variables
|
||||
set -a
|
||||
|
||||
# Source the .env file
|
||||
source .env
|
||||
|
||||
# Disable automatic export (optional, if you want to stop exporting variables)
|
||||
set +a
|
||||
|
||||
# Check if DOMAIN_OWNER is set
|
||||
if [ -z "$DOMAIN_OWNER" ]; then
|
||||
echo "DOMAIN_OWNER environment variable is not set."
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Fetch the CODEARTIFACT_AUTH_TOKEN
|
||||
CODEARTIFACT_AUTH_TOKEN=$(aws --region eu-central-1 codeartifact get-authorization-token --domain propeller --domain-owner $DOMAIN_OWNER --query authorizationToken --output text --duration 1800)
|
||||
|
||||
# Set the PIP_INDEX_URL
|
||||
PIP_INDEX_URL="https://aws:${CODEARTIFACT_AUTH_TOKEN}@propeller-${DOMAIN_OWNER}.d.codeartifact.eu-central-1.amazonaws.com/pypi/protosim/simple/"
|
||||
|
||||
# Export the variables
|
||||
export CODEARTIFACT_AUTH_TOKEN
|
||||
export PIP_INDEX_URL
|
||||
@@ -2,5 +2,5 @@ psycopg2==2.9.9
|
||||
PyYAML==6.0.1
|
||||
Requests==2.32.2
|
||||
web3==5.31.3
|
||||
tycho-indexer-client>=0.7.2
|
||||
tycho-simulation-py>=0.32.0
|
||||
git+https://github.com/propeller-heads/tycho-indexer.git@0.49.0#subdirectory=tycho-client-py
|
||||
git+https://github.com/propeller-heads/tycho-simulation.git@0.69.0#subdirectory=tycho_simulation_py
|
||||
@@ -1,5 +1,32 @@
|
||||
#!/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"
|
||||
@@ -15,8 +42,7 @@ source activate $ENV_NAME
|
||||
|
||||
# Install the requirements
|
||||
echo "Installing the requirements from ${REQUIREMENTS_FILE}..."
|
||||
source ./pre_build.sh
|
||||
pip install -r $REQUIREMENTS_FILE
|
||||
pip install -r $REQUIREMENTS_FILE --index-url https://pypi.org/simple
|
||||
conda activate $ENV_NAME
|
||||
|
||||
echo "Setup complete."
|
||||
Reference in New Issue
Block a user