From a5e0848c5030a8a47729ab4ae080ea5d738ddd77 Mon Sep 17 00:00:00 2001 From: Joshua Carroll Date: Thu, 22 Aug 2024 22:41:41 -0700 Subject: [PATCH 1/4] Add CI for testing --- .github/workflows/test.yml | 40 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..9ac21c5 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,40 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Python lint and test + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.12 + uses: actions/setup-python@v3 + with: + python-version: "3.12.3" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 + pip install -r requirements.txt + pip install -r test-requirements.txt + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + pytest From 12c4a953b210a31e8f74c141bc15cd442b0cb061 Mon Sep 17 00:00:00 2001 From: Joshua Carroll Date: Thu, 22 Aug 2024 22:47:52 -0700 Subject: [PATCH 2/4] CI fix --- .github/workflows/test.yml | 12 +++++++----- agent/research_assistant.py | 1 - agent/tools.py | 1 - 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9ac21c5..d7644d8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,12 +23,12 @@ jobs: uses: actions/setup-python@v3 with: python-version: "3.12.3" - - name: Install dependencies + - name: Install dependencies with uv run: | - python -m pip install --upgrade pip - pip install flake8 - pip install -r requirements.txt - pip install -r test-requirements.txt + curl -LsSf https://astral.sh/uv/install.sh | sh + uv pip install flake8 + uv pip install -r requirements.txt + uv pip install -r test-requirements.txt - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names @@ -37,4 +37,6 @@ jobs: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Test with pytest run: | + # ChatGroq won't initialize without a key + export GROQ_API_KEY=some-fake-groq-key pytest diff --git a/agent/research_assistant.py b/agent/research_assistant.py index 94a9783..2f96f44 100644 --- a/agent/research_assistant.py +++ b/agent/research_assistant.py @@ -1,5 +1,4 @@ from datetime import datetime -from typing import Literal from langchain_openai import ChatOpenAI from langchain_groq import ChatGroq from langchain_core.language_models.chat_models import BaseChatModel diff --git a/agent/tools.py b/agent/tools.py index 635c95e..e7ffa78 100644 --- a/agent/tools.py +++ b/agent/tools.py @@ -1,4 +1,3 @@ -import inspect import math import numexpr import re From 999a6dc77effd5137d8f3760158c36d57be8a121 Mon Sep 17 00:00:00 2001 From: Joshua Carroll Date: Thu, 22 Aug 2024 22:53:26 -0700 Subject: [PATCH 3/4] CI fixes --- .github/workflows/test.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d7644d8..c469414 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,15 +20,19 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python 3.12 - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: - python-version: "3.12.3" + python-version-file: ".python-version" + - name: Set up uv + run: | + curl -LsSf https://astral.sh/uv/0.3.2/install.sh | sh - name: Install dependencies with uv run: | - curl -LsSf https://astral.sh/uv/install.sh | sh uv pip install flake8 uv pip install -r requirements.txt uv pip install -r test-requirements.txt + env: + UV_SYSTEM_PYTHON: 1 - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names @@ -37,6 +41,6 @@ jobs: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Test with pytest run: | - # ChatGroq won't initialize without a key - export GROQ_API_KEY=some-fake-groq-key pytest + env: + GROQ_API_KEY: some-fake-groq-key From 5a721ce2e6170d1653d602bef336b80d4f7ca202 Mon Sep 17 00:00:00 2001 From: Joshua Carroll Date: Thu, 22 Aug 2024 22:55:23 -0700 Subject: [PATCH 4/4] fake openai key --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c469414..1d80785 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -43,4 +43,5 @@ jobs: run: | pytest env: - GROQ_API_KEY: some-fake-groq-key + OPENAI_API_KEY: sk-fake-openai-key + GROQ_API_KEY: gsk_fake_groq_key