Skip to content

Commit

Permalink
Use virtualenv instead of user space pip install
Browse files Browse the repository at this point in the history
  • Loading branch information
augusto-herrmann committed Mar 3, 2024
1 parent bf4edcb commit dbdbde5
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions .github/workflows/update_site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
branches:
- main

env:
PYTHON_VERSION: "3.11"

jobs:

build:
Expand All @@ -18,7 +21,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: ${{ env.PYTHON_VERSION }}

# Set up and use cache for Python dependencies
- name: Python dependencies cache
Expand All @@ -28,20 +31,22 @@ jobs:
# cache downloaded and installed packages
path: |
~/.cache/pip
~/.local/lib/python3.11/site-packages
~/.local/bin
~/.env/lib/${{ env.PYTHON_VERSION }}/site-packages
~/.env/bin
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
# Install Jupyter and any other Python packages defined in requirements.txt
# --user flag is necessary to be able to cache packages installed by pip,
# Virtualenv is necessary to be able to cache packages installed by pip,
# but not standard library Python packages
- name: Install Python dependencies
working-directory: jupyterlite
run: |
python -m pip install --user --upgrade pip
python -m pip install --user -r requirements.txt
python -m venv .env
source .env/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
# Set up and use cache for Jekyll page generation
- name: Jekyll rendered pages cache
Expand Down Expand Up @@ -71,6 +76,7 @@ jobs:
working-directory: jupyterlite
run: |
mkdir -p ../_site/notebooks/
source .env/bin/activate
jupyter lite build --contents notebooks --output-dir ../_site/notebooks
# Ready and upload artifact for deployment
Expand Down

0 comments on commit dbdbde5

Please sign in to comment.