Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
174 changes: 174 additions & 0 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
name: Python Tests (consolidated)

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
inputs:
run_providers:
description: 'Set to true to run the providers matrix (manual run)'
required: false
default: 'false'

jobs:
static-analysis:
name: Static analysis & unit tests (one python)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies for static
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-cov mypy
- name: Run ruff (lint)
run: |
python -m pip install ruff
python -m ruff check src/
- name: Run unit tests with coverage
run: |
PYTHONPATH=. pytest --cov=src/ --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: ./coverage.xml
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
- name: Run mypy static analysis
run: mypy src/ --ignore-missing-imports --exclude "src/llm/router.py"

Check failure

Code scanning / check-spelling

Unrecognized Spelling Error

llm is not a recognized word. (unrecognized-spelling)

tests:
name: Run tests matrix
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.11, 3.12]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m venv .venv_ci
. .venv_ci/bin/activate
pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
- name: Run tests
env:
PYTHONPATH: .
run: |
python -m pytest -q

deepagent-test:

Check failure

Code scanning / check-spelling

Unrecognized Spelling Error

deepagent is not a recognized word. (unrecognized-spelling)
Comment on lines +54 to +85

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 3 months ago

To fix the problem, add a permissions block at the root of the workflow file, specifying the minimum required permissions. For most CI jobs that only check out code and run tests, contents: read is sufficient. This block should be added immediately after the name: line and before the on: block, so it applies to all jobs unless overridden. No additional imports or definitions are needed; this is a YAML configuration change.

Suggested changeset 1
.github/workflows/python-test.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml
--- a/.github/workflows/python-test.yml
+++ b/.github/workflows/python-test.yml
@@ -1,3 +1,5 @@
+permissions:
+  contents: read
 name: Python Tests (consolidated)
 
 on:
EOF
@@ -1,3 +1,5 @@
permissions:
contents: read
name: Python Tests (consolidated)

on:
Copilot is powered by AI and may make mistakes. Always verify output.
name: DeepAgent focused tests (fast)
runs-on: ubuntu-latest
needs: tests
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-3.12-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install test deps only
run: |
python -m pip install --upgrade pip
python -m venv .venv_ci
. .venv_ci/bin/activate
pip install --upgrade pip setuptools wheel
pip install pytest python-dotenv
- name: Run deepagent unit tests

Check failure

Code scanning / check-spelling

Unrecognized Spelling Error

deepagent is not a recognized word. (unrecognized-spelling)
env:
PYTHONPATH: .
run: |
python -m pytest -q test/unit/test_deepagent.py test/unit/test_deepagent_providers.py

Check warning

Code scanning / check-spelling

Candidate Pattern Warning

Line matches candidate pattern \\b(?i)py(?!gments|gmy|lon|ramid|ro|th)(?=[a-z]{2,}) (candidate-pattern)

Check failure

Code scanning / check-spelling

Unrecognized Spelling Error

deepagent is not a recognized word. (unrecognized-spelling)

Check failure

Code scanning / check-spelling

Unrecognized Spelling Error

deepagent is not a recognized word. (unrecognized-spelling)

provider-smoke:
Comment on lines +86 to +115

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 3 months ago

To fix the problem, add a permissions block to the deepagent-test job in .github/workflows/python-test.yml, setting it to the minimum required permissions. Since the job only checks out code and runs tests, it only needs contents: read. This change should be made directly under the deepagent-test: job definition, before the runs-on key. No other changes are required.


Suggested changeset 1
.github/workflows/python-test.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml
--- a/.github/workflows/python-test.yml
+++ b/.github/workflows/python-test.yml
@@ -84,6 +84,8 @@
 
   deepagent-test:
     name: DeepAgent focused tests (fast)
+    permissions:
+      contents: read
     runs-on: ubuntu-latest
     needs: tests
     steps:
EOF
@@ -84,6 +84,8 @@

deepagent-test:
name: DeepAgent focused tests (fast)
permissions:
contents: read
runs-on: ubuntu-latest
needs: tests
steps:
Copilot is powered by AI and may make mistakes. Always verify output.
name: Provider smoke (manual)
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch'
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Install provider packages
run: |
python -m pip install --upgrade pip
python -m venv .venv_ci
. .venv_ci/bin/activate
pip install --upgrade pip setuptools wheel
pip install langchain-google-genai langchain-community langchain-ollama python-dotenv

Check failure

Code scanning / check-spelling

Unrecognized Spelling Error

langchain is not a recognized word. (unrecognized-spelling)

Check failure

Code scanning / check-spelling

Unrecognized Spelling Error

genai is not a recognized word. (unrecognized-spelling)

Check failure

Code scanning / check-spelling

Unrecognized Spelling Error

langchain is not a recognized word. (unrecognized-spelling)

Check failure

Code scanning / check-spelling

Unrecognized Spelling Error

langchain is not a recognized word. (unrecognized-spelling)

Check failure

Code scanning / check-spelling

Unrecognized Spelling Error

ollama is not a recognized word. (unrecognized-spelling)
- name: Cache pip for provider-smoke
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-provider-smoke-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Quick deepagent smoke (dry-run disabled)

Check failure

Code scanning / check-spelling

Unrecognized Spelling Error

deepagent is not a recognized word. (unrecognized-spelling)
env:
PYTHONPATH: .
run: |
python -c "from src.agents import deepagent; a=deepagent.SDLCFlexibleAgent(provider='gemini', model='chat-bison-001', dry_run=True); print('constructed', getattr(a, 'llm', None))"

Check failure

Code scanning / check-spelling

Unrecognized Spelling Error

llm is not a recognized word. (unrecognized-spelling)

providers:
name: Providers matrix (optional)
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' && github.event.inputs.run_providers == 'true'
strategy:
matrix:
provider: [gemini, openai, ollama]

Check failure

Code scanning / check-spelling

Unrecognized Spelling Error

openai is not a recognized word. (unrecognized-spelling)

Check failure

Code scanning / check-spelling

Unrecognized Spelling Error

ollama is not a recognized word. (unrecognized-spelling)
steps:
- uses: actions/checkout@v4
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-providers-${{ matrix.provider }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Install provider packages
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install langchain-google-genai langchain-community langchain-ollama

Check failure

Code scanning / check-spelling

Unrecognized Spelling Error

langchain is not a recognized word. (unrecognized-spelling)

Check failure

Code scanning / check-spelling

Unrecognized Spelling Error

genai is not a recognized word. (unrecognized-spelling)

Check failure

Code scanning / check-spelling

Unrecognized Spelling Error

langchain is not a recognized word. (unrecognized-spelling)

Check failure

Code scanning / check-spelling

Unrecognized Spelling Error

ollama is not a recognized word. (unrecognized-spelling)
- name: Run provider smoke for matrix provider
env:
PYTHONPATH: .
run: |
python -c "from src.agents import deepagent; p='${{ matrix.provider }}'; d = deepagent.SDLCFlexibleAgent(provider=p, dry_run=True); print('provider', p, 'dry_run', getattr(d, 'dry_run', False))"
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.PHONY: test lint clean

# Run tests using the reproducible script (creates .venv_ci)
test:
./scripts/run-tests.sh

# Run lint and static checks
lint:
# Fast lint with ruff and type check with mypy
python3 -m pip install --upgrade pip
pip install ruff mypy
python3 -m ruff check src/
python3 -m mypy src/ --ignore-missing-imports

clean:
rm -rf .venv_ci
34 changes: 30 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,29 @@
- `README.md` – Project overview and usage
- `Dockerfile` – Container build instructions

## Running tests

We provide a small helper script that creates an isolated virtualenv and runs the test suite.

Run the full test suite locally:

```bash
./scripts/run-tests.sh
```

Or run just the deepagent tests (fast):

```bash
./scripts/run-tests.sh test/unit -k deepagent
```

You can also use the Makefile targets:

```bash
make test
make lint
```

---

## Contributing
Expand All @@ -163,7 +186,7 @@

If you would like to ask a question that you feel doesn't warrant an issue (yet), please reach out to us via Twitter:

* contact [info@softwaredevlabs.com][conduct-email]
- contact [info@softwaredevlabs.com][conduct-email]

Check failure

Code scanning / check-spelling

Unrecognized Spelling Error

softwaredevlabs is not a recognized word. (unrecognized-spelling)

## Developer Guidance

Expand All @@ -190,9 +213,9 @@
This is a work in progress as we learn what we'll need to provide people in
order to be effective contributors to our project.

* [Coding Style](./doc/STYLE.md)
* [Code Organization](./doc/ORGANIZATION.md)
* [Exceptions in our legacy codebase](./doc/EXCEPTIONS.md)
- [Coding Style](./doc/STYLE.md)
- [Code Organization](./doc/ORGANIZATION.md)
- [Exceptions in our legacy codebase](./doc/EXCEPTIONS.md)

---

Expand All @@ -201,4 +224,7 @@
This project has adopted the [Code of Conduct][conduct-code]. For more information see the [Code of Conduct][conduct-code] or contact [info@softwaredevlabs.com][conduct-email] with any additional questions or comments.

[conduct-code](./CODE_OF_CONDUCT.md)

[conduct-email]: mailto:info@softwaredevlabs.com
[conduct-code]: ./CODE_OF_CONDUCT.md
[conduct-email]: mailto:info@softwaredevlabs.com
18 changes: 18 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

langchain==0.3.27
# Note: `langchain-deepagent` is not published on PyPI at the pinned version and
# caused CI install failures. It's intentionally omitted here; install any
# deepagent/local adapters manually or in provider-specific CI jobs.

# Keep provider adapters optional; install them per-job if needed
# Provider adapters (optional) - pinned to validated versions from the dev environment
langchain-google-genai==2.1.9
langchain-community==0.3.27
# Ollama adapter left unpinned (install per-job if needed)
langchain-ollama==0.3.6

# python-dotenv used by the module when running locally
python-dotenv==1.1.1

# Test/runtime helpers
pytest==8.4.1
20 changes: 20 additions & 0 deletions scripts/run-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -euo pipefail

Check warning

Code scanning / check-spelling

Candidate Pattern Warning

Check failure

Code scanning / check-spelling

Unrecognized Spelling Error

euo is not a recognized word. (unrecognized-spelling)

Check failure

Code scanning / check-spelling

Unrecognized Spelling Error

pipefail is not a recognized word. (unrecognized-spelling)

# Lightweight test runner that creates an isolated venv, installs pinned deps,
# and runs pytest for the repository. Designed for CI and local reproducibility.

ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
VENV_DIR="$ROOT_DIR/.venv_ci"

echo "Using venv: $VENV_DIR"

if [ ! -d "$VENV_DIR" ]; then
python3 -m venv "$VENV_DIR"
fi

"$VENV_DIR/bin/python" -m pip install --upgrade pip setuptools wheel
"$VENV_DIR/bin/python" -m pip install -r "$ROOT_DIR/requirements.txt"
"$VENV_DIR/bin/python" -m pip install pytest==8.4.1

PYTHONPATH="$ROOT_DIR" "$VENV_DIR/bin/python" -m pytest "$@"
Loading