3 Commits

Author SHA1 Message Date
091a2a0f97 fix colors linting
Some checks failed
Test Suite / test (3.12) (push) Successful in 1m27s
Test Suite / test (3.11) (push) Successful in 1m29s
Test Suite / lint (push) Failing after 10s
Test Suite / build (push) Has been skipped
Test Suite / test (3.11) (pull_request) Has been cancelled
Test Suite / test (3.12) (pull_request) Has been cancelled
Test Suite / lint (pull_request) Has been cancelled
Test Suite / build (pull_request) Has been cancelled
Security Scan / security (pull_request) Failing after 39s
Security Scan / dependency-check (pull_request) Failing after 34s
2025-08-13 20:40:08 -07:00
48326c6335 fix linting and other ci errors 2025-08-13 20:39:53 -07:00
450f6b23e0 add ci workflows
Some checks failed
Test Suite / test (3.11) (push) Successful in 2m17s
Test Suite / test (3.12) (push) Successful in 2m20s
Test Suite / lint (push) Failing after 39s
Test Suite / build (push) Has been skipped
Security Scan / security (pull_request) Failing after 50s
Security Scan / dependency-check (pull_request) Failing after 47s
Test Suite / test (3.11) (pull_request) Successful in 1m32s
Test Suite / lint (pull_request) Failing after 23s
Test Suite / test (3.12) (pull_request) Successful in 1m24s
Test Suite / build (pull_request) Has been skipped
2025-08-13 20:26:06 -07:00
9 changed files with 355 additions and 9 deletions

View File

@@ -0,0 +1,94 @@
name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Release version (e.g., v1.0.0)'
required: true
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"
- name: Set up Python
run: uv python install 3.11
- name: Install dependencies
run: uv sync
- name: Run full test suite
run: |
uv add pytest-cov
uv run pytest tests/ -v --cov=src/embeddingbuddy --cov-report=term-missing
build-and-release:
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"
- name: Set up Python
run: uv python install 3.11
- name: Install dependencies
run: uv sync
- name: Build package
run: uv build
- name: Create release notes
run: |
echo "# Release Notes" > release-notes.md
echo "" >> release-notes.md
echo "## What's New" >> release-notes.md
echo "" >> release-notes.md
echo "- Modular architecture with improved testability" >> release-notes.md
echo "- Comprehensive test suite" >> release-notes.md
echo "- Enhanced documentation" >> release-notes.md
echo "- Security scanning and dependency management" >> release-notes.md
echo "" >> release-notes.md
echo "## Installation" >> release-notes.md
echo "" >> release-notes.md
echo '```bash' >> release-notes.md
echo 'uv sync' >> release-notes.md
echo 'uv run python main.py' >> release-notes.md
echo '```' >> release-notes.md
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITEA_TOKEN }}
with:
tag_name: ${{ github.ref_name || github.event.inputs.version }}
release_name: Release ${{ github.ref_name || github.event.inputs.version }}
body_path: release-notes.md
draft: false
prerelease: false
- name: Upload Release Assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITEA_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/
asset_name: embeddingbuddy-dist
asset_content_type: application/zip

View File

@@ -0,0 +1,76 @@
name: Security Scan
on:
push:
branches: ["main", "master", "develop"]
pull_request:
branches: ["main", "master"]
schedule:
# Run security scan weekly on Sundays at 2 AM UTC
- cron: '0 2 * * 0'
jobs:
security:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"
- name: Set up Python
run: uv python install 3.11
- name: Install dependencies
run: uv sync
- name: Add security tools
run: |
uv add bandit[toml]
uv add safety
- name: Run bandit security linter
run: uv run bandit -r src/ -f json -o bandit-report.json
continue-on-error: true
- name: Run safety vulnerability check
run: uv run safety check --json --save-json safety-report.json
continue-on-error: true
- name: Upload security reports
uses: actions/upload-artifact@v4
with:
name: security-reports
path: |
bandit-report.json
safety-report.json
dependency-check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"
- name: Set up Python
run: uv python install 3.11
- name: Check for dependency vulnerabilities
run: |
uv sync
uv add pip-audit
uv run pip-audit --format=json --output=pip-audit-report.json
continue-on-error: true
- name: Upload dependency audit report
uses: actions/upload-artifact@v4
with:
name: dependency-audit
path: pip-audit-report.json

106
.gitea/workflows/test.yml Normal file
View File

@@ -0,0 +1,106 @@
name: Test Suite
on:
push:
branches: ["*"]
pull_request:
branches: ["main", "master"]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync
- name: Run tests with pytest
run: uv run pytest tests/ -v --tb=short
- name: Run tests with coverage
run: |
uv add pytest-cov
uv run pytest tests/ --cov=src/embeddingbuddy --cov-report=term-missing --cov-report=xml
- name: Upload coverage reports
uses: codecov/codecov-action@v4
if: matrix.python-version == '3.11'
with:
file: ./coverage.xml
fail_ci_if_error: false
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"
- name: Set up Python
run: uv python install 3.11
- name: Install dependencies
run: uv sync
- name: Add linting tools
run: |
uv add ruff
uv add mypy
- name: Run ruff linter
run: uv run ruff check src/ tests/
- name: Run ruff formatter check
run: uv run ruff format --check src/ tests/
- name: Run mypy type checker
run: uv run mypy src/embeddingbuddy/ --ignore-missing-imports
build:
runs-on: ubuntu-latest
needs: [test, lint]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"
- name: Set up Python
run: uv python install 3.11
- name: Install dependencies
run: uv sync
- name: Build package
run: uv build
- name: Test installation
run: |
uv run python -c "from src.embeddingbuddy.app import create_app; app = create_app(); print('✅ Package builds and imports successfully')"
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist-files
path: dist/

76
.gitignore vendored
View File

@@ -1,12 +1,84 @@
# Python-generated files # Python-generated files
__pycache__/ __pycache__/
*.py[oc] *.py[oc]
*.py[cod]
*$py.class
*.so
.Python
build/ build/
develop-eggs/
dist/ dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/ wheels/
*.egg-info share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
*.manifest
*.spec
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Virtual environments # Virtual environments
.env
.venv .venv
env/
venv/
ENV/
env.bak/
venv.bak/
# IDEs
.vscode/
.idea/
*.swp
*.swo
*~
# OS
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
# Project specific
*.log
.mypy_cache/
.dmypy.json
dmypy.json
temp/ temp/
todo/ todo/
# Security reports
bandit-report.json
safety-report.json
pip-audit-report.json
# Temporary files
*.tmp

View File

@@ -1,8 +1,8 @@
import json import json
import uuid import uuid
import base64 import base64
from typing import List, Union from typing import List
from ..models.schemas import Document, ProcessedData from ..models.schemas import Document
class NDJSONParser: class NDJSONParser:

View File

@@ -1,6 +1,5 @@
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
import numpy as np import numpy as np
from typing import Optional, Tuple
from sklearn.decomposition import PCA from sklearn.decomposition import PCA
import umap import umap
from openTSNE import TSNE from openTSNE import TSNE

View File

@@ -1,4 +1,4 @@
from typing import List, Optional, Any, Dict from typing import List, Optional
from dataclasses import dataclass from dataclasses import dataclass
import numpy as np import numpy as np

View File

@@ -1,4 +1,3 @@
import numpy as np
from dash import callback, Input, Output, State from dash import callback, Input, Output, State
from ...data.processor import DataProcessor from ...data.processor import DataProcessor

View File

@@ -1,4 +1,4 @@
from typing import List, Dict, Any from typing import List
import plotly.colors as pc import plotly.colors as pc
from ..models.schemas import Document from ..models.schemas import Document
@@ -29,5 +29,5 @@ class ColorMapper:
gray_value * 0.7 + rgb[1] * 0.3, gray_value * 0.7 + rgb[1] * 0.3,
gray_value * 0.7 + rgb[2] * 0.3) gray_value * 0.7 + rgb[2] * 0.3)
return f'rgb({int(gray_rgb[0])},{int(gray_rgb[1])},{int(gray_rgb[2])})' return f'rgb({int(gray_rgb[0])},{int(gray_rgb[1])},{int(gray_rgb[2])})'
except: except: # noqa: E722
return 'rgb(128,128,128)' return 'rgb(128,128,128)'