Skip to content
Open
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
6 changes: 3 additions & 3 deletions .github/workflows/dependabot.yml → .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ updates:
schedule:
interval: "daily"
groups:
python-dependencies:
patterns:
- "*"
python-dependencies:
patterns:
- "*"

# Maintain GitHub Actions dependencies
- package-ecosystem: "github-actions"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
uv run pyinstaller calango.spec --clean

- name: 📤 Upload Artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.artifact_name }}
path: ${{ matrix.executable_path }}
Expand Down
75 changes: 58 additions & 17 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# .github/workflows/ci.yml
# .github/workflows/ci.yaml
name: CI & Security

on:
Expand All @@ -13,43 +13,84 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v3
- uses: astral-sh/setup-uv@v5
- name: Set up Python
run: uv python install 3.12

- name: Install Dependencies
run: uv sync --group dev

- name: Check Formatting & Linting
run: make check

test:
unit-tests:
name: 🧪 Unit Tests
runs-on: ubuntu-latest
needs: quality
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v3
- uses: astral-sh/setup-uv@v5
- run: uv sync --group dev
- name: Run Unit Tests
run: make test

integration-tests:
name: 🔗 Integration Tests
runs-on: ubuntu-latest
needs: quality
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
- run: uv sync --group dev
- name: Run Integration Tests
run: make test-integration

e2e-tests:
name: 🎭 E2E Tests
runs-on: ubuntu-latest
needs: quality
env:
CALANGO_HOME: ${{ github.workspace }}/test_run
OPENAI_API_BASE: "http://localhost:8080"
OPENAI_API_KEY: "sk-mock"
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
- name: Set up Python
run: uv python install 3.12

- name: Install Dependencies
run: uv sync --group dev
run: |
uv sync --group dev
# Explicitly install flask into the environment for the mock server
uv pip install flask

- name: Run Pytest
run: make test
- name: Install Playwright Browsers
run: uv run playwright install --with-deps chromium

- name: Run E2E Tests
run: |
mkdir -p $CALANGO_HOME

# 1. Seed the database using uv run to ensure path/module context
uv run python -c "from calango.database import ConfigManager, PersonaManager; cm = ConfigManager(); cm.upsert_provider('openai', 'sk-mock', ['gpt-4o-mini']); PersonaManager()"

# 2. Start Mock SSE Server using 'uv run' to access the installed Flask
uv run python -c "from flask import Flask, Response; import time; app=Flask(__name__); app.add_url_rule('/chat/completions', 'mock', lambda: (time.sleep(0.5), Response('data: {\"choices\": [{\"delta\": {\"content\": \"Mock response\"}}], \"usage\": {\"prompt_tokens\": 5, \"completion_tokens\": 5}}\n\ndata: [DONE]\n\n', mimetype='text/event-stream'))[1], methods=['POST']); app.run(port=8080)" &

# 3. Start App in background
uv run streamlit run src/app.py --server.headless true &

# 4. Wait for both servers to be ready
sleep 15

# 5. Run tests
make test-e2e

security:
name: 🛡️ CVE Scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v3
- name: Set up Python
run: uv python install 3.12

- name: Install Dependencies
run: uv sync --group dev

- name: Run pip-audit (CVE Scan)
- uses: astral-sh/setup-uv@v5
- run: uv sync --group dev
- name: Run Security Audit
run: make security
14 changes: 7 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ The output will be in the `dist/` folder.

* **`src/app.py`**: The main entry point and navigation logic.
* **`src/calango/`**: Core logic.
* `core.py`: LLM interaction logic (LiteLLM wrapper).
* `database.py`: TinyDB handling (History, Configs, Personas).
* `themes.py`: The color palettes and CSS injection.
* `core.py`: LLM interaction logic (LiteLLM wrapper).
* `database.py`: TinyDB handling (History, Configs, Personas).
* `themes.py`: The color palettes and CSS injection.

* **`src/ui/`**: Streamlit pages.
* `home.py`: The main Chat interface.
* `rinha.py`: The "Danger Room" (Model Comparison).
* `dashboard.py`: "A Cuca" (Analytics).
* `settings.py`: "A Toca" (Config & Personas).
* `home.py`: The main Chat interface.
* `rinha.py`: The "Danger Room" (Model Comparison).
* `dashboard.py`: "A Cuca" (Analytics).
* `settings.py`: "A Toca" (Config & Personas).

## 🎨 How to Add a New Theme

Expand Down
24 changes: 16 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ setup-ollama: ## Run Ollama inside a Docker container (Port 11434)

@echo "⏳ Waiting for Ollama to boot..."
@sleep 3
@echo "📥 Pulling default model (Llama 3)..."

@echo "📥 Pulling models (llama3, mistral, gemma2)..."
@docker exec calango-ollama ollama pull llama3

@echo "✅ Ollama is ready at http://localhost:11434"
@docker exec calango-ollama ollama pull mistral
@docker exec calango-ollama ollama pull gemma2

@echo "✅ Ollama is ready at http://localhost:11434 with 3 models"

install: ## Install dependencies using uv
@echo "$(GREEN)>>> Installing dependencies...$(NC)"
Expand Down Expand Up @@ -68,23 +70,29 @@ spell-check: ## Spell check project.
@echo "$(GREEN)*** Spell check complete! ***$(NC)"

# --- Testing ---
# ... existing variables ...

test: ## Run unit tests (excludes integration tests).
test: ## Run unit tests only (excludes integration and e2e)
@echo "$(GREEN)>>> Running unit tests...$(NC)"
@$(UV) run pytest -m "not integration"
@$(UV) run pytest -m "not integration and not e2e"

test-integration: ## Run integration tests only.
test-integration: ## Run integration tests only
@echo "$(GREEN)>>> Running integration tests...$(NC)"
@$(UV) run pytest -m "integration"

test-all: ## Run ALL tests (unit + integration).
test-e2e: ## Run E2E tests only
@echo "$(GREEN)>>> Running E2E tests...$(NC)"
@$(UV) run pytest -m "e2e"

test-all: ## Run everything
@echo "$(GREEN)>>> Running all tests...$(NC)"
@$(UV) run pytest

coverage: ## Run tests and generate coverage report.
@echo "$(GREEN)>>> Running tests with coverage...$(NC)"
@$(UV) run pytest --cov=$(SRC_DIR) --cov-report=term-missing --cov-report=html


# --- CI/CD Check ---

check: format lint test ## Run format, lint, and unit tests (Recommended for pre-commit).
Expand Down
26 changes: 0 additions & 26 deletions SECURITY.md

This file was deleted.

142 changes: 0 additions & 142 deletions docs/01 Great Refactor.md

This file was deleted.

File renamed without changes.
Loading
Loading