diff --git a/.github/workflows/examples_check.yml b/.github/workflows/examples_check.yml index 9be015077..464cb0b6d 100644 --- a/.github/workflows/examples_check.yml +++ b/.github/workflows/examples_check.yml @@ -37,26 +37,49 @@ jobs: # with: # path: ~/.cache/pypoetry # key: poetry-cache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ env.POETRY_VERSION }} - - name: Install Poetry - uses: snok/install-poetry@v1 - with: - virtualenvs-create: true - virtualenvs-in-project: true - installer-parallel: true + # - name: Install Poetry + # uses: snok/install-poetry@v1 + # with: + # virtualenvs-create: true + # virtualenvs-in-project: true + # installer-parallel: true - name: Install dependencies run: | - make full; - poetry add "openai>=1.2.4" jupyter nbconvert cohere==5.3.2; - - name: Check for pypdfium2 - run: poetry run pip show pypdfium2 + # Legacy run script + # make full; + # poetry add "openai>=1.2.4" jupyter nbconvert cohere==5.3.2; + + # Setup Virtual Environment + python3 -m venv ./.venv + source .venv/bin/activate + + # Install the current branch + pip install . + + # Install extra stuff for notebook runs + pip install "huggingface_hub[cli]" jupyter nbconvert cohere==5.3.2 + pip install nltk + echo "which python $(which python)" + echo "which pip $(which pip)" + echo "pip show nltk: $(pip show nltk)" - name: Huggingface Hub Login - run: poetry run huggingface-cli login --token $HUGGINGFACE_API_KEY + run: | + source .venv/bin/activate + echo "which python: $(which python)" + echo "which pip $(which pip)" + huggingface-cli login --token $HUGGINGFACE_API_KEY - name: download nltk data run: | + source .venv/bin/activate + echo "which pip $(which pip)" + echo "pip show nltk: $(pip show nltk)" mkdir /tmp/nltk_data; - poetry run python -m nltk.downloader -d /tmp/nltk_data punkt; - - name: Use venv - run: source .venv/bin/activate + python -m nltk.downloader -d /tmp/nltk_data punkt; + # - name: Use venv + # run: source .venv/bin/activate - name: Execute notebooks and check for errors - run: bash ./.github/workflows/scripts/run_notebooks.sh ${{ matrix.notebook }} + # run: bash ./.github/workflows/scripts/run_notebooks.sh ${{ matrix.notebook }} + run: | + source .venv/bin/activate + bash ./.github/workflows/scripts/run_notebooks.sh ${{ matrix.notebook }} diff --git a/.github/workflows/install_from_hub.yml b/.github/workflows/install_from_hub.yml index c39cc8502..1e6483547 100644 --- a/.github/workflows/install_from_hub.yml +++ b/.github/workflows/install_from_hub.yml @@ -1,4 +1,4 @@ -name: Notebook Execution and Error Check +name: Install from Hub on: push: diff --git a/.github/workflows/scripts/run_notebooks.sh b/.github/workflows/scripts/run_notebooks.sh index e32932948..cd854ceb6 100755 --- a/.github/workflows/scripts/run_notebooks.sh +++ b/.github/workflows/scripts/run_notebooks.sh @@ -1,6 +1,10 @@ #!/bin/bash export NLTK_DATA=/tmp/nltk_data; +# Remove the local guardrails directory and use the installed version +rm -rf ./guardrails + +# Navigate to notebooks cd docs/examples # Get the notebook name from the matrix variable @@ -10,10 +14,12 @@ notebook="$1" invalid_notebooks=("valid_chess_moves.ipynb" "llamaindex-output-parsing.ipynb" "competitors_check.ipynb") if [[ ! " ${invalid_notebooks[@]} " =~ " ${notebook} " ]]; then echo "Processing $notebook..." - poetry run jupyter nbconvert --to notebook --execute "$notebook" + # poetry run jupyter nbconvert --to notebook --execute "$notebook" + jupyter nbconvert --to notebook --execute "$notebook" if [ $? -ne 0 ]; then echo "Error found in $notebook" echo "Error in $notebook. See logs for details." >> errors.txt + exit 1 fi fi