Skip to content

Commit

Permalink
refactor: stop using private pypi (#132)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
zizou0x and zizou0x authored Jan 16, 2025
1 parent 5f319a6 commit 98c63c6
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 42 deletions.
2 changes: 1 addition & 1 deletion substreams/crates/tycho-substreams/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 change: 0 additions & 1 deletion testing/.env.default
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export RPC_URL=https://mainnet.infura.io/v3/your-infura-key
export SUBSTREAMS_API_TOKEN="changeme"
export DOMAIN_OWNER="AWSAccountId"
21 changes: 11 additions & 10 deletions testing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

**DOMAIN_OWNER**
## Prerequisites

- **Description**: The domain owner identifier for Propellerhead's AWS account, used for authenticating on the private
PyPI repository.
- **Example**: `export DOMAIN_OWNER=123456789`
Before setting up the Python environment, ensure the following tools and libraries are installed on your system:

### Step 2: Create python virtual environment for testing
- **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/)

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
```
Expand Down
26 changes: 0 additions & 26 deletions testing/pre_build.sh

This file was deleted.

4 changes: 2 additions & 2 deletions testing/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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[email protected]#subdirectory=tycho-client-py
git+https://github.com/propeller-heads/tycho-simulation[email protected]#subdirectory=tycho_simulation_py
30 changes: 28 additions & 2 deletions testing/setup_env.sh
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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."

0 comments on commit 98c63c6

Please sign in to comment.