diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml new file mode 100644 index 0000000..050d0fb --- /dev/null +++ b/.github/workflows/install.yml @@ -0,0 +1,24 @@ +name: Install + +on: + push: + branches: + - main + pull_request: + branches: + - "**" + +jobs: + install: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: true + matrix: + os: [macos-latest, ubuntu-latest] + steps: + - name: Check out code + uses: actions/checkout@v2 + + - name: Run the install script + run: | + curl -sSL "https://raw.githubusercontent.com/hhamud/dasy/main/scripts/install.sh" | bash diff --git a/README.org b/README.org index 8c534ac..ffcd1e6 100644 --- a/README.org +++ b/README.org @@ -28,6 +28,12 @@ Learn more in the [[file:docs.org][documentation]] #+end_src * Installation + +** Using a Bash script (Only MacOS and Linux) +#+begin_src bash +curl -sSL "https://raw.githubusercontent.com/hhamud/dasy/main/install.sh" | bash +#+end_src + ** For use as a library #+begin_src bash pip install git+https://github.com/dasylang/dasy.git diff --git a/pyproject.toml b/pyproject.toml index 864c231..cd12d20 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,6 +15,7 @@ vyper = "^0.3.9" eth-abi = "^4.0.0" eth-typing = "^3.2.0" py-evm = ">=0.6.1a2" +eth-ape = "^0.6.15" [tool.poetry.dev-dependencies] pytest = ">=7.1" diff --git a/scripts/.gitignore b/scripts/.gitignore new file mode 100644 index 0000000..f77b374 --- /dev/null +++ b/scripts/.gitignore @@ -0,0 +1,10 @@ +# Ape stuff +.build/ +.cache/ + +# Python +.env +.venv +.pytest_cache +.python-version +__pycache__ diff --git a/scripts/install.sh b/scripts/install.sh new file mode 100644 index 0000000..a570700 --- /dev/null +++ b/scripts/install.sh @@ -0,0 +1,63 @@ +#!/bin/bash + + +set -e + +# Constants +PYTHON_VERSION="3.10" # Use Python v3.10 + +# Function to check if a command exists +command_exists() { + command -v "$1" &>/dev/null +} + +# Function to install Python v3.11 if not already installed +install_python() { + if ! command_exists python$PYTHON_VERSION; then + echo "Python is not installed. Installing Python v$PYTHON_VERSION..." + if [[ "$(uname)" == "Linux" ]]; then + sudo apt-get update + sudo apt-get install -y python$PYTHON_VERSION + elif [[ "$(uname)" == "Darwin" ]]; then + # Install Python using Homebrew + brew install python@$PYTHON_VERSION + export PATH="/usr/local/opt/python@$PYTHON_VERSION/bin:$PATH" + else + echo "The shell script is not suitable for Windows." + exit 1 + fi + else + echo "Python is already installed." + fi +} + +# Function to install eth-ape using Poetry +install_eth_ape() { + echo "Installing eth-ape..." + python$PYTHON_VERSION -m pip install --upgrade pip + pip install --user eth-ape +} + +# Function to install APE-Dasy using Poetry +install_ape_dasy() { + echo "Installing APE-Dasy..." + python$PYTHON_VERSION -m pip install --upgrade pip + pip install --user ape-dasy +} + +# Main script +main() { + # Install Python v3.11 (if not already installed) + install_python + + # Install eth-ape using Poetry + install_eth_ape + + # Install APE-Dasy using Poetry + install_ape_dasy + + echo "Setup complete. eth-ape and APE-Dasy have been installed." +} + +# Run the main script +main