diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..5ff1618e --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,8 @@ +# Funding options for Semantica +# Uncomment and add your usernames/links below + +# github: [username] +# patreon: username +# ko_fi: username +# custom: ["https://your-funding-page.com"] + diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 7dc393d7..2b702ee7 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,12 +1,8 @@ -blank_issues_enabled: false +blank_issues_enabled: true contact_links: - - name: GitHub Discussions + - name: ๐Ÿ“š Documentation + url: https://github.com/Hawksight-AI/semantica/tree/main/docs + about: Browse the documentation + - name: ๐Ÿ’ฌ Discussions url: https://github.com/Hawksight-AI/semantica/discussions - about: Ask questions and discuss ideas with the community - - name: Discord Community - url: https://discord.gg/semantica - about: Join our Discord server for real-time help and discussions - - name: Security Issues - url: https://github.com/Hawksight-AI/semantica/security/advisories/new - about: Report security vulnerabilities privately - + about: Ask questions and discuss with the community diff --git a/.github/ISSUE_TEMPLATE/documentation.md b/.github/ISSUE_TEMPLATE/documentation.md new file mode 100644 index 00000000..f0bd77ef --- /dev/null +++ b/.github/ISSUE_TEMPLATE/documentation.md @@ -0,0 +1,60 @@ +--- +name: Documentation Issue +about: Report issues with documentation or suggest improvements +title: '[DOCS] ' +labels: documentation +assignees: '' +--- + +## Documentation Issue Type + + + +- [ ] Missing documentation +- [ ] Incorrect/outdated documentation +- [ ] Unclear documentation +- [ ] Broken link +- [ ] Code example not working +- [ ] API reference incomplete +- [ ] Tutorial improvement + +## Location + +**Documentation URL**: + +**Section/Page**: + +## Issue Description + + + +## Current Documentation + + + +``` +Current text here +``` + +## Suggested Improvement + + + +``` +Suggested text here +``` + +## Expected Information + + + +## Additional Context + +- Is this blocking your work? [Yes/No] +- Related code/features: +- Useful references or examples: + +## Contribution + +- [ ] I'm willing to submit a PR to fix this documentation issue + diff --git a/.github/ISSUE_TEMPLATE/documentation_issue.md b/.github/ISSUE_TEMPLATE/documentation_issue.md deleted file mode 100644 index dcac72c3..00000000 --- a/.github/ISSUE_TEMPLATE/documentation_issue.md +++ /dev/null @@ -1,64 +0,0 @@ ---- -name: Documentation Issue -about: Report an issue or suggest improvements to documentation -title: '[DOCS] ' -labels: documentation -assignees: '' ---- - -## Documentation Section - -Which section or page is affected? - -- [ ] Getting Started -- [ ] API Reference -- [ ] Concepts -- [ ] Cookbook -- [ ] Examples -- [ ] Other: ___________ - -**URL or File Path**: [e.g., docs/getting-started.md] - -## Current Content - -What is the current content or issue? - -```markdown -Paste current content here -``` - -## Problem - -What is wrong or unclear about the current documentation? - -- [ ] Typo or grammar error -- [ ] Outdated information -- [ ] Missing information -- [ ] Unclear explanation -- [ ] Broken link -- [ ] Code example doesn't work -- [ ] Other: ___________ - -## Proposed Changes - -What should the documentation say instead? - -```markdown -Proposed content here -``` - -## Rationale - -Why is this change needed? How does it improve the documentation? - -## Additional Context - -- Screenshots (if applicable) -- Related issues or PRs -- Any other context - -## Contribution - -- [ ] I'm willing to submit a PR with the fix -- [ ] I can help review the changes - diff --git a/.github/ISSUE_TEMPLATE/grant.md b/.github/ISSUE_TEMPLATE/grant.md new file mode 100644 index 00000000..a9efdab8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/grant.md @@ -0,0 +1,49 @@ +--- +name: Grant or Partnership +about: Propose grants, partnerships, or collaboration opportunities +title: '[PARTNERSHIP] ' +labels: partnership +assignees: '' +--- + +## Organization/Individual + +**Name**: +**Website**: +**Contact Email**: + +## Type of Proposal + +- [ ] Research Grant +- [ ] Development Grant +- [ ] Academic Partnership +- [ ] Corporate Sponsorship +- [ ] Open Source Grant +- [ ] Other: + +## Proposal Summary + + + +## Objectives + + + +## Benefit to Semantica + + + +## Timeline + +**Start Date**: +**Duration**: +**Key Milestones**: + +## Funding/Resources + + + +## Additional Information + + + diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md deleted file mode 100644 index 53baaefc..00000000 --- a/.github/ISSUE_TEMPLATE/question.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -name: Question -about: Ask a question about Semantica -title: '[QUESTION] ' -labels: question -assignees: '' ---- - -## Question - -What is your question? - -## Context - -Provide context about your question: - -- What are you trying to accomplish? -- What have you tried so far? -- What specific aspect do you need help with? - -## Code Example - -If applicable, include code that demonstrates your question: - -```python -from semantica import Semantica - -# Your code here -``` - -## Environment - -- **OS**: [e.g., Windows 10, Ubuntu 22.04, macOS 13.0] -- **Python Version**: [e.g., 3.9.7] -- **Semantica Version**: [e.g., 0.0.1] - -## What You've Tried - -- [ ] Checked the documentation -- [ ] Searched GitHub issues -- [ ] Searched GitHub discussions -- [ ] Checked the cookbook examples -- [ ] Tried debugging on my own - -## Additional Information - -Any other information that might be helpful: - -- Error messages -- Logs -- Screenshots -- Related issues or discussions - -## Expected Response - -What kind of help are you looking for? - -- [ ] Quick answer -- [ ] Detailed explanation -- [ ] Code example -- [ ] Point to documentation -- [ ] Other: ___________ - diff --git a/.github/ISSUE_TEMPLATE/support.md b/.github/ISSUE_TEMPLATE/support.md new file mode 100644 index 00000000..5c99718e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/support.md @@ -0,0 +1,32 @@ +--- +name: Support Request +about: Get help or support for using Semantica +title: '[SUPPORT] ' +labels: support +assignees: '' +--- + +## What do you need help with? + + + +## Your Setup + +- **Semantica Version**: +- **Python Version**: +- **OS**: + +## What you're trying to do + + + +## Code Example (if applicable) + +```python +# Your code here +``` + +## What's not working + + + diff --git a/.github/README.md b/.github/README.md new file mode 100644 index 00000000..5a244261 --- /dev/null +++ b/.github/README.md @@ -0,0 +1,40 @@ +# GitHub Configuration for Semantica + +## ๐Ÿ“‹ Issue Templates + +- **[Bug Report](ISSUE_TEMPLATE/bug_report.md)** - Report bugs +- **[Feature Request](ISSUE_TEMPLATE/feature_request.md)** - Suggest features +- **[Documentation](ISSUE_TEMPLATE/documentation.md)** - Report docs issues +- **[Support](ISSUE_TEMPLATE/support.md)** - Get help +- **[Grant/Partnership](ISSUE_TEMPLATE/grant.md)** - Propose partnerships or funding + +## ๐Ÿ”„ Workflows + +- **[ci.yml](workflows/ci.yml)** - Build validation (runs on push/PR) +- **[release.yml](workflows/release.yml)** - Release to GitHub & PyPI (runs on version tags) +- **[security.yml](workflows/security.yml)** - Weekly dependency scan +- **[docs.yml](workflows/docs.yml)** - Deploy docs to GitHub Pages + +## ๐Ÿค Community + +- **[FUNDING.yml](FUNDING.yml)** - Sponsorship options +- **[SUPPORT.md](SUPPORT.md)** - How to get support +- **[Pull Request Template](pull_request_template.md)** - PR guidelines + +## ๐Ÿš€ Releasing a New Version + +```bash +# Update version in pyproject.toml and CHANGELOG.md +git tag v0.0.3 +git push origin v0.0.3 +# GitHub Actions automatically creates release and publishes to PyPI +``` + +**Setup Required (one-time):** +- GitHub: Create environment named `pypi` +- PyPI: Add trusted publisher for `Hawksight-AI/semantica` with workflow `release.yml` + +## ๐Ÿ“š Resources + +- [GitHub Actions Docs](https://docs.github.com/en/actions) +- [PyPI Trusted Publishing](https://docs.pypi.org/trusted-publishers/) diff --git a/.github/SUPPORT.md b/.github/SUPPORT.md new file mode 100644 index 00000000..d9645f0b --- /dev/null +++ b/.github/SUPPORT.md @@ -0,0 +1,43 @@ +# Support for Semantica + +## Getting Help + +### ๐Ÿ“š Documentation +Check the [docs folder](https://github.com/Hawksight-AI/semantica/tree/main/docs) and [README](https://github.com/Hawksight-AI/semantica/blob/main/README.md) for guides and examples. + +### ๐Ÿ’ฌ Community Support +- **GitHub Discussions**: [Ask questions](https://github.com/Hawksight-AI/semantica/discussions) +- **Discord**: Join our [Discord server](https://discord.gg/semantica) for real-time chat + +### ๐Ÿ› Bug Reports +Found a bug? [Create an issue](https://github.com/Hawksight-AI/semantica/issues/new/choose) + +### ๐Ÿ“– Resources +- [Quick Start Guide](https://github.com/Hawksight-AI/semantica/blob/main/docs/quickstart.md) +- [FAQ](https://github.com/Hawksight-AI/semantica/blob/main/docs/faq.md) +- [Cookbook Examples](https://github.com/Hawksight-AI/semantica/tree/main/cookbook) + +## Commercial Support + +For enterprise support, custom development, or consulting services: +- Email: semantica-dev@users.noreply.github.com +- Include "Commercial Support" in the subject line + +## Sponsorship + +Support Semantica development: +- [GitHub Sponsors](https://github.com/sponsors/Hawksight-AI) + +Your sponsorship helps us: +- Maintain and improve the framework +- Add new features and integrations +- Provide better documentation +- Support the community + +## Response Times + +- **Community Support**: Best effort by community members +- **Bug Reports**: Reviewed within 7 days +- **Security Issues**: Reviewed within 48 hours +- **Sponsored Support**: Priority response (24-48 hours) + diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 9006c0dc..40c88106 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,120 +1,76 @@ ## Description - + ## Type of Change - - - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Documentation update -- [ ] Code refactoring - [ ] Performance improvement -- [ ] Test addition or update -- [ ] Other (please describe): ___________ +- [ ] Code refactoring ## Related Issues Closes # -Related to # Fixes # ## Changes Made -- Change 1 -- Change 2 -- Change 3 +- +- +- ## Testing - + -- [ ] Tests pass locally -- [ ] Added new tests for new functionality -- [ ] Updated existing tests -- [ ] All tests pass (`pytest`) -- [ ] Code coverage maintained or improved +- [ ] Tested locally +- [ ] Added tests for new functionality +- [ ] Package builds successfully (`python -m build`) -### Test Results +### Test Commands -``` -Paste test output or command here +```bash +# Build the package +pip install build +python -m build + +# Optional: Run your own tests +pytest tests/ + +# Optional: Format code +black semantica/ +isort semantica/ ``` ## Documentation - - - [ ] Updated relevant documentation - [ ] Added code examples if applicable - [ ] Updated API reference if adding new APIs - [ ] Updated cookbook if adding new examples - [ ] No documentation changes needed -## Code Quality - - - -- [ ] Code follows style guidelines (black, isort, flake8) -- [ ] Type hints added for new functions -- [ ] Docstrings added/updated -- [ ] No new warnings or errors -- [ ] Self-review completed - -### Code Quality Checks - -```bash -# Run these commands and ensure they pass -black semantica/ tests/ -isort semantica/ tests/ -flake8 semantica/ tests/ -mypy semantica/ -pytest -``` - ## Breaking Changes - - **Breaking Changes**: [Yes/No] -If yes, describe: -- What breaks -- Why it's necessary -- How to migrate - -## Screenshots / Examples - - - -```python -# Example usage of new feature -``` + ## Checklist - - - [ ] My code follows the project's style guidelines - [ ] I have performed a self-review of my code - [ ] I have commented my code, particularly in hard-to-understand areas -- [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings -- [ ] I have added tests that prove my fix is effective or that my feature works -- [ ] New and existing unit tests pass locally with my changes -- [ ] Any dependent changes have been merged and published +- [ ] Package builds successfully ## Additional Notes - - -## Reviewer Notes - - - + diff --git a/.github/scripts/README.md b/.github/scripts/README.md deleted file mode 100644 index 2779a2af..00000000 --- a/.github/scripts/README.md +++ /dev/null @@ -1,137 +0,0 @@ -# Development Scripts - -Helper scripts for development, testing, and code quality checks. - -## Available Scripts - -### Setup Scripts - -#### `setup-dev.sh` / `setup-dev.ps1` -Sets up the development environment. - -**Bash (Linux/macOS):** -```bash -bash .github/scripts/setup-dev.sh -``` - -**PowerShell (Windows):** -```powershell -.github\scripts\setup-dev.ps1 -``` - -**What it does:** -- Checks Python version -- Creates virtual environment if needed -- Installs package with dev dependencies -- Sets up pre-commit hooks -- Verifies installation - -### Code Quality Scripts - -#### `check-code.sh` / `check-code.ps1` -Runs all code quality checks (formatting, linting, type checking). - -**Bash:** -```bash -bash .github/scripts/check-code.sh -``` - -**PowerShell:** -```powershell -.github\scripts\check-code.ps1 -``` - -**What it checks:** -- Code formatting (black) -- Import sorting (isort) -- Linting (flake8) -- Type checking (mypy - non-blocking) - -#### `format-code.sh` / `format-code.ps1` -Automatically formats code and sorts imports. - -**Bash:** -```bash -bash .github/scripts/format-code.sh -``` - -**PowerShell:** -```powershell -.github\scripts\format-code.ps1 -``` - -**What it does:** -- Formats code with black -- Sorts imports with isort - -### Testing Scripts - -#### `run-tests.sh` / `run-tests.ps1` -Runs tests with coverage reporting. - -**Bash:** -```bash -bash .github/scripts/run-tests.sh -``` - -**PowerShell:** -```powershell -.github\scripts\run-tests.ps1 -``` - -**What it does:** -- Runs pytest with coverage -- Generates HTML and terminal coverage reports -- Coverage report: `htmlcov/index.html` - -## Quick Start - -1. **Setup development environment:** - ```bash - # Linux/macOS - bash .github/scripts/setup-dev.sh - - # Windows - .github\scripts\setup-dev.ps1 - ``` - -2. **Before committing, run checks:** - ```bash - # Linux/macOS - bash .github/scripts/check-code.sh - - # Windows - .github\scripts\check-code.ps1 - ``` - -3. **If checks fail, format code:** - ```bash - # Linux/macOS - bash .github/scripts/format-code.sh - - # Windows - .github\scripts\format-code.ps1 - ``` - -4. **Run tests:** - ```bash - # Linux/macOS - bash .github/scripts/run-tests.sh - - # Windows - .github\scripts\run-tests.ps1 - ``` - -## Requirements - -- Python 3.10+ -- Virtual environment (created by setup script) -- Dev dependencies installed (`pip install -e ".[dev]"`) - -## Notes - -- All scripts automatically activate the virtual environment if it exists -- Scripts check for required directories before running -- Error messages provide helpful guidance -- Type checking (mypy) is non-blocking and won't fail the check - diff --git a/.github/scripts/check-code.ps1 b/.github/scripts/check-code.ps1 deleted file mode 100644 index b9811bfc..00000000 --- a/.github/scripts/check-code.ps1 +++ /dev/null @@ -1,63 +0,0 @@ -# Code quality check script (PowerShell) -# Runs formatting, import sorting, linting, and type checking - -$ErrorActionPreference = "Stop" - -Write-Host "๐Ÿ” Running code quality checks..." -ForegroundColor Cyan - -# Activate virtual environment if it exists -if (Test-Path "venv") { - & .\venv\Scripts\Activate.ps1 -} - -# Check if directories exist -if (-not (Test-Path "semantica")) { - Write-Host "โŒ semantica/ directory not found" -ForegroundColor Red - exit 1 -} - -# Check formatting -Write-Host "๐Ÿ“ Checking code formatting (black)..." -ForegroundColor Yellow -try { - black --check semantica/ 2>&1 | Out-Null - Write-Host "โœ… Black check passed" -ForegroundColor Green -} catch { - Write-Host "โŒ Code formatting issues found" -ForegroundColor Red - Write-Host " Run: black semantica/" -ForegroundColor Yellow - exit 1 -} - -# Check import sorting -Write-Host "๐Ÿ“ฆ Checking import sorting (isort)..." -ForegroundColor Yellow -try { - isort --check-only semantica/ 2>&1 | Out-Null - Write-Host "โœ… isort check passed" -ForegroundColor Green -} catch { - Write-Host "โŒ Import sorting issues found" -ForegroundColor Red - Write-Host " Run: isort semantica/" -ForegroundColor Yellow - exit 1 -} - -# Lint with flake8 -Write-Host "๐Ÿ”Ž Linting with flake8..." -ForegroundColor Yellow -try { - flake8 semantica/ - Write-Host "โœ… flake8 check passed" -ForegroundColor Green -} catch { - Write-Host "โŒ Linting issues found" -ForegroundColor Red - exit 1 -} - -# Type check with mypy -Write-Host "๐Ÿ”ฌ Type checking with mypy..." -ForegroundColor Yellow -try { - mypy semantica/ - Write-Host "โœ… mypy check passed" -ForegroundColor Green -} catch { - Write-Host "โŒ Type checking issues found" -ForegroundColor Red - exit 1 -} - -Write-Host "" -Write-Host "โœ… All code quality checks passed!" -ForegroundColor Green - diff --git a/.github/scripts/check-code.sh b/.github/scripts/check-code.sh deleted file mode 100644 index 48c016d3..00000000 --- a/.github/scripts/check-code.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash -# Code quality check script -# Runs formatting, import sorting, linting, and type checking - -set -e - -echo "๐Ÿ” Running code quality checks..." - -# Activate virtual environment if it exists -if [ -d "venv" ]; then - source venv/bin/activate -fi - -# Check if directories exist -if [ ! -d "semantica" ]; then - echo "โŒ semantica/ directory not found" - exit 1 -fi - -# Check formatting -echo "๐Ÿ“ Checking code formatting (black)..." -if black --check semantica/ 2>/dev/null; then - echo "โœ… Black check passed" -else - echo "โŒ Code formatting issues found" - echo " Run: black semantica/" - exit 1 -fi - -# Check import sorting -echo "๐Ÿ“ฆ Checking import sorting (isort)..." -if isort --check-only semantica/ 2>/dev/null; then - echo "โœ… isort check passed" -else - echo "โŒ Import sorting issues found" - echo " Run: isort semantica/" - exit 1 -fi - -# Lint with flake8 -echo "๐Ÿ”Ž Linting with flake8..." -if flake8 semantica/; then - echo "โœ… flake8 check passed" -else - echo "โŒ Linting issues found" - exit 1 -fi - -# Type check with mypy -echo "๐Ÿ”ฌ Type checking with mypy..." -if mypy semantica/; then - echo "โœ… mypy check passed" -else - echo "โŒ Type checking issues found" - exit 1 -fi - -echo "" -echo "โœ… All code quality checks passed!" - diff --git a/.github/scripts/format-code.ps1 b/.github/scripts/format-code.ps1 deleted file mode 100644 index 470b617d..00000000 --- a/.github/scripts/format-code.ps1 +++ /dev/null @@ -1,31 +0,0 @@ -# Code formatting script (PowerShell) -# Formats code with black and sorts imports with isort - -$ErrorActionPreference = "Stop" - -Write-Host "๐ŸŽจ Formatting code..." -ForegroundColor Cyan - -# Activate virtual environment if it exists -if (Test-Path "venv") { - & .\venv\Scripts\Activate.ps1 -} - -# Check if directories exist -if (-not (Test-Path "semantica")) { - Write-Host "โŒ semantica/ directory not found" -ForegroundColor Red - exit 1 -} - -# Format with black -Write-Host "๐Ÿ“ Formatting with black..." -ForegroundColor Yellow -black semantica/ -Write-Host "โœ… Black formatting complete" -ForegroundColor Green - -# Sort imports with isort -Write-Host "๐Ÿ“ฆ Sorting imports with isort..." -ForegroundColor Yellow -isort semantica/ -Write-Host "โœ… Import sorting complete" -ForegroundColor Green - -Write-Host "" -Write-Host "โœ… Code formatting complete!" -ForegroundColor Green - diff --git a/.github/scripts/format-code.sh b/.github/scripts/format-code.sh deleted file mode 100644 index 22ab6918..00000000 --- a/.github/scripts/format-code.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# Code formatting script -# Formats code with black and sorts imports with isort - -set -e - -echo "๐ŸŽจ Formatting code..." - -# Activate virtual environment if it exists -if [ -d "venv" ]; then - source venv/bin/activate -fi - -# Check if directories exist -if [ ! -d "semantica" ]; then - echo "โŒ semantica/ directory not found" - exit 1 -fi - -# Format with black -echo "๐Ÿ“ Formatting with black..." -black semantica/ -echo "โœ… Black formatting complete" - -# Sort imports with isort -echo "๐Ÿ“ฆ Sorting imports with isort..." -isort semantica/ -echo "โœ… Import sorting complete" - -echo "" -echo "โœ… Code formatting complete!" - diff --git a/.github/scripts/run-tests.ps1 b/.github/scripts/run-tests.ps1 deleted file mode 100644 index 974f125b..00000000 --- a/.github/scripts/run-tests.ps1 +++ /dev/null @@ -1,41 +0,0 @@ -# Test runner script (PowerShell) -# Runs tests with coverage reporting - -$ErrorActionPreference = "Stop" - -Write-Host "๐Ÿงช Running tests..." -ForegroundColor Cyan - -# Activate virtual environment if it exists -if (Test-Path "venv") { - & .\venv\Scripts\Activate.ps1 -} - -# Check if tests directory exists -if (-not (Test-Path "tests")) { - Write-Host "โš ๏ธ No tests directory found" -ForegroundColor Yellow - Write-Host " Create tests/ directory and add test files" -ForegroundColor Yellow - exit 0 -} - -# Check if test files exist -$testFiles = Get-ChildItem -Path tests -Recurse -Include "test_*.py", "*_test.py" -ErrorAction SilentlyContinue -if (-not $testFiles) { - Write-Host "โš ๏ธ No test files found" -ForegroundColor Yellow - Write-Host " Add test files to tests/ directory" -ForegroundColor Yellow - exit 0 -} - -# Run tests with coverage -Write-Host "๐Ÿ“Š Running pytest with coverage..." -ForegroundColor Yellow -pytest ` - --cov=semantica ` - --cov-report=html ` - --cov-report=term-missing ` - --cov-report=xml ` - -v ` - tests/ - -Write-Host "" -Write-Host "โœ… Tests complete!" -ForegroundColor Green -Write-Host "๐Ÿ“Š Coverage report: htmlcov/index.html" -ForegroundColor Cyan - diff --git a/.github/scripts/run-tests.sh b/.github/scripts/run-tests.sh deleted file mode 100644 index c9dcdcc0..00000000 --- a/.github/scripts/run-tests.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -# Test runner script -# Runs tests with coverage reporting - -set -e - -echo "๐Ÿงช Running tests..." - -# Activate virtual environment if it exists -if [ -d "venv" ]; then - source venv/bin/activate -fi - -# Check if tests directory exists -if [ ! -d "tests" ]; then - echo "โš ๏ธ No tests directory found" - echo " Create tests/ directory and add test files" - exit 0 -fi - -# Check if test files exist -if [ -z "$(find tests -name 'test_*.py' -o -name '*_test.py' 2>/dev/null)" ]; then - echo "โš ๏ธ No test files found" - echo " Add test files to tests/ directory" - exit 0 -fi - -# Run tests with coverage -echo "๐Ÿ“Š Running pytest with coverage..." -pytest \ - --cov=semantica \ - --cov-report=html \ - --cov-report=term-missing \ - --cov-report=xml \ - -v \ - tests/ - -echo "" -echo "โœ… Tests complete!" -echo "๐Ÿ“Š Coverage report: htmlcov/index.html" - diff --git a/.github/scripts/setup-dev.ps1 b/.github/scripts/setup-dev.ps1 deleted file mode 100644 index bb1f8293..00000000 --- a/.github/scripts/setup-dev.ps1 +++ /dev/null @@ -1,68 +0,0 @@ -# Development environment setup script (PowerShell) -# Sets up Python virtual environment and installs dependencies - -$ErrorActionPreference = "Stop" - -Write-Host "๐Ÿš€ Setting up development environment..." -ForegroundColor Cyan - -# Check Python version -try { - $pythonVersion = python --version 2>&1 - Write-Host "๐Ÿ“ฆ $pythonVersion" -ForegroundColor Green -} catch { - Write-Host "โŒ Python not found. Please install Python 3.10 or higher" -ForegroundColor Red - exit 1 -} - -# Create virtual environment if it doesn't exist -if (-not (Test-Path "venv")) { - Write-Host "๐Ÿ“ฆ Creating virtual environment..." -ForegroundColor Yellow - python -m venv venv -} else { - Write-Host "โœ… Virtual environment already exists" -ForegroundColor Green -} - -# Activate virtual environment -Write-Host "๐Ÿ”Œ Activating virtual environment..." -ForegroundColor Yellow -& .\venv\Scripts\Activate.ps1 - -# Upgrade pip -Write-Host "โฌ†๏ธ Upgrading pip..." -ForegroundColor Yellow -python -m pip install --upgrade pip - -# Install project in editable mode with dev dependencies -Write-Host "๐Ÿ“ฅ Installing package with dev dependencies..." -ForegroundColor Yellow -pip install -e ".[dev]" - -# Install pre-commit hooks if available -try { - $precommit = Get-Command pre-commit -ErrorAction SilentlyContinue - if ($precommit) { - Write-Host "๐Ÿช Installing pre-commit hooks..." -ForegroundColor Yellow - pre-commit install - } else { - Write-Host "โš ๏ธ pre-commit not found, skipping hooks installation" -ForegroundColor Yellow - } -} catch { - Write-Host "โš ๏ธ Pre-commit installation skipped" -ForegroundColor Yellow -} - -# Verify installation -Write-Host "โœ… Verifying installation..." -ForegroundColor Yellow -try { - python -c "import semantica; print(f'Semantica version: {semantica.__version__}')" - Write-Host "โœ… Installation verified" -ForegroundColor Green -} catch { - Write-Host "โŒ Installation verification failed" -ForegroundColor Red - exit 1 -} - -Write-Host "" -Write-Host "โœจ Development environment setup complete!" -ForegroundColor Green -Write-Host "" -Write-Host "Next steps:" -ForegroundColor Cyan -Write-Host " .\venv\Scripts\Activate.ps1 # Activate virtual environment" -ForegroundColor White -Write-Host " pytest # Run tests" -ForegroundColor White -Write-Host " black semantica/ # Format code" -ForegroundColor White -Write-Host " .github\scripts\check-code.ps1 # Run all checks" -ForegroundColor White - diff --git a/.github/scripts/setup-dev.sh b/.github/scripts/setup-dev.sh deleted file mode 100644 index f13e3bda..00000000 --- a/.github/scripts/setup-dev.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash -# Development environment setup script -# Sets up Python virtual environment and installs dependencies - -set -e - -echo "๐Ÿš€ Setting up development environment..." - -# Check Python version -if ! command -v python3 &> /dev/null; then - echo "โŒ Python 3 not found. Please install Python 3.10 or higher" - exit 1 -fi - -python_version=$(python3 --version 2>&1 | awk '{print $2}') -echo "๐Ÿ“ฆ Python version: $python_version" - -# Create virtual environment if it doesn't exist -if [ ! -d "venv" ]; then - echo "๐Ÿ“ฆ Creating virtual environment..." - python3 -m venv venv -else - echo "โœ… Virtual environment already exists" -fi - -# Activate virtual environment -echo "๐Ÿ”Œ Activating virtual environment..." -source venv/bin/activate - -# Upgrade pip -echo "โฌ†๏ธ Upgrading pip..." -python -m pip install --upgrade pip - -# Install project in editable mode with dev dependencies -echo "๐Ÿ“ฅ Installing package with dev dependencies..." -pip install -e ".[dev]" - -# Install pre-commit hooks if available -if command -v pre-commit &> /dev/null; then - echo "๐Ÿช Installing pre-commit hooks..." - pre-commit install || echo "โš ๏ธ Pre-commit installation skipped" -else - echo "โš ๏ธ pre-commit not found, skipping hooks installation" -fi - -# Verify installation -echo "โœ… Verifying installation..." -if python -c "import semantica; print(f'Semantica version: {semantica.__version__}')" 2>/dev/null; then - echo "โœ… Installation verified" -else - echo "โŒ Installation verification failed" - exit 1 -fi - -echo "" -echo "โœจ Development environment setup complete!" -echo "" -echo "Next steps:" -echo " source venv/bin/activate # Activate virtual environment" -echo " pytest # Run tests" -echo " black semantica/ # Format code" -echo " .github/scripts/check-code.sh # Run all checks" - diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index adcac1a0..e6e712c5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,75 +1,18 @@ name: CI -# Runs tests across multiple Python versions and performs code quality checks -# Includes test coverage reporting and linting with flake8 and mypy - on: push: - branches: [main, develop] + branches: [main] pull_request: - branches: [main, develop] - -permissions: - contents: read + branches: [main] jobs: - test: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: ['3.10', '3.11', '3.12'] - - steps: - - uses: actions/checkout@v4 - - - name: Free Disk Space - uses: jlumbroso/free-disk-space@main - with: - tool-cache: false - android: true - dotnet: true - haskell: true - large-packages: true - docker-images: true - swap-storage: true - - - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - run: | - pip install -e ".[dev]" - - - run: pytest --cov=semantica --cov-report=xml --cov-report=term-missing -v - - - name: Upload coverage - if: matrix.python-version == '3.11' - uses: codecov/codecov-action@v3 - with: - file: ./coverage.xml - - lint: + build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - - name: Free Disk Space - uses: jlumbroso/free-disk-space@main - with: - tool-cache: false - android: true - dotnet: true - haskell: true - large-packages: true - docker-images: true - swap-storage: true - - uses: actions/setup-python@v5 with: python-version: '3.11' - - - run: pip install -e ".[dev]" - - - run: flake8 semantica/ - - run: mypy semantica/ + - run: pip install build + - run: python -m build diff --git a/.github/workflows/label-issues.yml b/.github/workflows/label-issues.yml deleted file mode 100644 index 684acc57..00000000 --- a/.github/workflows/label-issues.yml +++ /dev/null @@ -1,107 +0,0 @@ -name: Auto-label Issues - -# This workflow automatically labels new issues based on their content -# It also provides help resources if the user asks for help - -on: - issues: - types: [opened] - issue_comment: - types: [created] - -# Permissions needed to add labels and comments -permissions: - contents: read - issues: write - pull-requests: read - -jobs: - label: - name: Auto-label Issues - runs-on: ubuntu-latest - if: github.event.action == 'opened' - steps: - - name: Add labels based on content - # Uses a script to check title/body for keywords like "bug", "feature", etc. - uses: actions/github-script@v7 - with: - script: | - const issue = context.payload.issue; - const title = issue.title.toLowerCase(); - const body = (issue.body || '').toLowerCase(); - const text = title + ' ' + body; - - const labels = []; - - // Bug detection - if ((text.match(/\b(bug|crash|broken|fails|doesn't work|not working)\b/) && - text.match(/\b(error|exception|traceback|problem)\b/)) || - title.startsWith('bug:') || title.startsWith('[bug]')) { - labels.push('bug'); - } - - // Feature request - else if (text.match(/\b(feature request|enhancement request|proposal)\b/) || - title.startsWith('feature:') || title.startsWith('[feature]') || - title.startsWith('enhancement:') || title.startsWith('[enhancement]')) { - labels.push('enhancement'); - } - - // Documentation - else if (text.match(/\b(documentation issue|doc fix|docs update)\b/) || - title.startsWith('docs:') || title.startsWith('[docs]')) { - labels.push('documentation'); - } - - // Security - else if (text.match(/\b(security issue|vulnerability|security bug)\b/) || - title.startsWith('security:') || title.startsWith('[security]')) { - labels.push('security'); - } - - // Needs triage for incomplete issues - if (labels.length === 0 && (body.length < 50 || !body.includes('\n'))) { - labels.push('needs-triage'); - } - - // Add labels if found - if (labels.length > 0) { - await github.rest.issues.addLabels({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: issue.number, - labels: labels - }); - } - - help: - name: Provide Help Resources - runs-on: ubuntu-latest - # Runs if the issue contains "/help" - if: | - github.event.action == 'opened' && - (contains(github.event.issue.body, '/help') || contains(github.event.issue.title, '/help')) - steps: - - name: Post help resources - uses: actions/github-script@v7 - with: - script: | - const response = `๐Ÿ“š **Help Resources** - -Here are some helpful resources: - -- [Getting Started](https://github.com/${{ github.repository }}/blob/main/docs/getting-started.md) -- [FAQ](https://github.com/${{ github.repository }}/blob/main/docs/faq.md) -- [Documentation](https://github.com/${{ github.repository }}/tree/main/docs) -- [GitHub Discussions](https://github.com/${{ github.repository }}/discussions) - Ask questions here -- [Discord](https://discord.gg/semantica) - Real-time chat - -๐Ÿ’ก **Tip**: For questions, consider using [GitHub Discussions](https://github.com/${{ github.repository }}/discussions) instead of issues.`; - - await github.rest.issues.createComment({ - issue_number: context.payload.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: response - }); - diff --git a/.github/workflows/mark-answered.yml b/.github/workflows/mark-answered.yml deleted file mode 100644 index 072a4ace..00000000 --- a/.github/workflows/mark-answered.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: Mark Discussion as Answered - -# This workflow allows maintainers to mark a discussion comment as the answer -# Usage: Comment "/answered" on the correct reply - -on: - discussion_comment: - types: [created] - -# Permissions needed to modify discussions -permissions: - contents: read - discussions: write - -jobs: - mark-answered: - name: Mark Discussion as Answered - runs-on: ubuntu-latest - # Only runs if the comment contains "/answered" and is from a maintainer - if: | - github.event.action == 'created' && - contains(github.event.comment.body, '/answered') && - (github.event.comment.author_association == 'MEMBER' || - github.event.comment.author_association == 'OWNER' || - github.event.comment.author_association == 'COLLABORATOR') - steps: - - name: Mark discussion as answered - uses: actions/github-script@v7 - with: - script: | - const discussion = context.payload.discussion; - const commentId = context.payload.comment.id; - - try { - // Mark the comment as the answer - await github.rest.discussions.markAnswerComment({ - discussion_number: discussion.number, - comment_number: commentId, - owner: context.repo.owner, - repo: context.repo.repo - }); - - // Mark the discussion as answered - await github.rest.discussions.markAsAnswer({ - discussion_number: discussion.number, - comment_number: commentId, - owner: context.repo.owner, - repo: context.repo.repo - }); - } catch (error) { - console.log('Could not mark as answered:', error.message); - } - diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml deleted file mode 100644 index 96c5841e..00000000 --- a/.github/workflows/pypi.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Publish to PyPI - -# This workflow publishes the package to PyPI (Python Package Index) -# It runs automatically after a GitHub Release is published - -on: - release: - types: [published] - workflow_dispatch: - -jobs: - publish: - name: Publish to PyPI - runs-on: ubuntu-latest - environment: - name: pypi - url: https://pypi.org/project/semantica/${{ github.event.release.tag_name }}/ - - # Permissions needed to authenticate with PyPI - permissions: - id-token: write - contents: read - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.11" - - - name: Install build tools - run: | - python -m pip install --upgrade pip - pip install build twine - - - name: Build package - # Builds the package again to ensure it's fresh - run: python -m build - - - name: Publish to PyPI - # Uses Trusted Publishing (OIDC) to upload to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - packages-dir: dist/ - print-hash: true - diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c55cf4ce..4d56ef88 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,62 +1,25 @@ -name: Create Release - -# This workflow creates a GitHub Release when you push a version tag -# Example tag: v1.0.0 +name: Release on: push: - tags: - - 'v*' + tags: ['v*'] -# Permissions needed to create a release permissions: contents: write id-token: write jobs: release: - name: Create Release runs-on: ubuntu-latest + environment: pypi steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up Python - uses: actions/setup-python@v5 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: '3.11' - - - name: Install build tools - run: | - python -m pip install --upgrade pip - pip install build twine - - - name: Extract version from tag - id: tag - run: | - VERSION=${GITHUB_REF#refs/tags/v} - echo "VERSION=$VERSION" >> $GITHUB_OUTPUT - echo "Version: $VERSION" - - - name: Build package - # Builds the Python package (wheel and source distribution) - run: python -m build - - - name: Validate package - # Checks if the package description is valid - run: twine check dist/* - - - name: Create GitHub Release - # Creates the release on GitHub and attaches the built files - uses: softprops/action-gh-release@v1 + - run: pip install build + - run: python -m build + - uses: softprops/action-gh-release@v1 with: - tag_name: ${{ github.ref_name }} - name: Release ${{ steps.tag.outputs.VERSION }} - body_path: CHANGELOG.md - draft: false - prerelease: false - generate_release_notes: true files: dist/* - + - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml index c962e98e..55a088a4 100644 --- a/.github/workflows/security.yml +++ b/.github/workflows/security.yml @@ -1,65 +1,18 @@ -name: Security Scan - -# Scans dependencies and code for security vulnerabilities -# Runs on push, PR, weekly schedule, and manual trigger +name: Security on: - push: - branches: [main, develop] - pull_request: - branches: [main, develop] schedule: - cron: '0 0 * * 1' workflow_dispatch: -permissions: - contents: read - security-events: write - jobs: - dependency-scan: + audit: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - - name: Free Disk Space - uses: jlumbroso/free-disk-space@main - with: - tool-cache: false - android: true - dotnet: true - haskell: true - large-packages: true - docker-images: true - swap-storage: true - - uses: actions/setup-python@v5 with: python-version: '3.11' - - - run: | - pip install safety pip-audit - pip install -e ".[dev]" - + - run: pip install pip-audit - run: pip-audit - - run: safety check - continue-on-error: true - - code-scan: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: aquasecurity/trivy-action@master - with: - scan-type: 'fs' - scan-ref: '.' - format: 'sarif' - output: 'trivy-results.sarif' - severity: 'CRITICAL,HIGH' - - - uses: github/codeql-action/upload-sarif@v3 - if: always() && hashFiles('trivy-results.sarif') != '' - with: - sarif_file: 'trivy-results.sarif' continue-on-error: true