From da27027963b7e135c8a3939326fac3dbd939304d Mon Sep 17 00:00:00 2001 From: cfav-dev Date: Wed, 8 Nov 2023 00:16:45 +0800 Subject: [PATCH] fix(C4 W3 lab 4): fix compatibility issues with workflow and app dependencies --- .github/workflows/course4-week3-lab.yml | 10 +++++----- .../C4_W3_Lab_4_Github_Actions/README.md | 9 +++++---- .../C4_W3_Lab_4_Github_Actions/app/main.py | 4 ++-- .../C4_W3_Lab_4_Github_Actions/requirements.txt | 8 ++++---- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.github/workflows/course4-week3-lab.yml b/.github/workflows/course4-week3-lab.yml index 1806e5ec3..8eb36d301 100644 --- a/.github/workflows/course4-week3-lab.yml +++ b/.github/workflows/course4-week3-lab.yml @@ -19,19 +19,19 @@ jobs: run: # Use bash as the shell shell: bash - # Specify the working directory for the worflow + # Specify the working directory for the workflow working-directory: course4/week3-ungraded-labs/C4_W3_Lab_4_Github_Actions/ # Steps represent a sequence of tasks that will be executed as part of the job steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: - python-version: '3.11' + python-version: '3.8' - name: Install dependencies run: | @@ -41,4 +41,4 @@ jobs: name: Test with pytest run: | cd app/ - pytest + pytest \ No newline at end of file diff --git a/course4/week3-ungraded-labs/C4_W3_Lab_4_Github_Actions/README.md b/course4/week3-ungraded-labs/C4_W3_Lab_4_Github_Actions/README.md index ad176a27f..9b8674d56 100644 --- a/course4/week3-ungraded-labs/C4_W3_Lab_4_Github_Actions/README.md +++ b/course4/week3-ungraded-labs/C4_W3_Lab_4_Github_Actions/README.md @@ -88,20 +88,21 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: - python-version: '3.7.7' + python-version: '3.8' - name: Install dependencies run: | python -m pip install --upgrade pip - pip install numpy fastapi uvicorn scikit-learn pytest + pip install -r requirements.txt - name: Test with pytest run: | + cd app/ pytest ``` diff --git a/course4/week3-ungraded-labs/C4_W3_Lab_4_Github_Actions/app/main.py b/course4/week3-ungraded-labs/C4_W3_Lab_4_Github_Actions/app/main.py index 9676807ca..2f94e9ff2 100644 --- a/course4/week3-ungraded-labs/C4_W3_Lab_4_Github_Actions/app/main.py +++ b/course4/week3-ungraded-labs/C4_W3_Lab_4_Github_Actions/app/main.py @@ -14,7 +14,7 @@ class Wine(BaseModel): - batches: List[conlist(item_type=float, min_items=13, max_items=13)] + batches: List[conlist(item_type=float, min_length=13, max_length=13)] @app.post("/predict") @@ -22,4 +22,4 @@ def predict(wine: Wine): batches = wine.batches np_batches = np.array(batches) pred = clf.predict(np_batches).tolist() - return {"Prediction": pred} + return {"Prediction": pred} \ No newline at end of file diff --git a/course4/week3-ungraded-labs/C4_W3_Lab_4_Github_Actions/requirements.txt b/course4/week3-ungraded-labs/C4_W3_Lab_4_Github_Actions/requirements.txt index f14418b20..5ca9131d2 100644 --- a/course4/week3-ungraded-labs/C4_W3_Lab_4_Github_Actions/requirements.txt +++ b/course4/week3-ungraded-labs/C4_W3_Lab_4_Github_Actions/requirements.txt @@ -1,4 +1,4 @@ -fastapi -uvicorn -scikit-learn -pytest +fastapi==0.104.1 +uvicorn==0.24.0 +scikit-learn==0.24.2 +pytest==7.4.3