diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..3a0fdc3 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,32 @@ +# ============================================================================= +# Dependabot — Automated dependency updates +# ============================================================================= + +version: 2 + +updates: + # Python (pip) dependencies from pyproject.toml + - package-ecosystem: "pip" + directory: "/" + schedule: + interval: "weekly" + day: "monday" + commit-message: + prefix: "deps" + labels: + - "dependencies" + - "python" + open-pull-requests-limit: 10 + + # GitHub Actions versions + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + day: "monday" + commit-message: + prefix: "ci" + labels: + - "dependencies" + - "github-actions" + open-pull-requests-limit: 5 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..3795ca4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,129 @@ +# ============================================================================= +# ExplainFlow — Continuous Integration +# ============================================================================= +# Runs on every push and pull request to main. +# Matrix: Python 3.9 · 3.10 · 3.11 · 3.12 × ubuntu-latest +# Jobs: lint → test (with coverage) → build verification +# ============================================================================= + +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + # --------------------------------------------------------------------------- + # Lint & Type-check (fast-fail gate) + # --------------------------------------------------------------------------- + lint: + name: "Lint & Type-check" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + with: + persist-credentials: false + + - uses: actions/setup-python@v6 + with: + python-version: "3.12" + cache: pip + cache-dependency-path: pyproject.toml + + - name: Install dev dependencies + run: pip install -e ".[dev]" + + - name: Ruff (lint + format check) + run: | + ruff check src/ tests/ + ruff format --check src/ tests/ + + - name: Black (format check) + run: black --check src/ tests/ + + - name: Mypy (type-check) + run: mypy src/explainflow/ + + # --------------------------------------------------------------------------- + # Test matrix + # --------------------------------------------------------------------------- + test: + name: "Test · Python ${{ matrix.python-version }}" + needs: lint + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12"] + + steps: + - uses: actions/checkout@v6 + with: + persist-credentials: false + + - uses: actions/setup-python@v6 + with: + python-version: ${{ matrix.python-version }} + cache: pip + cache-dependency-path: pyproject.toml + + - name: Install dependencies + run: pip install -e ".[all]" + + - name: Run tests with coverage + run: | + pytest tests/ \ + -v \ + --tb=short \ + --cov=explainflow \ + --cov-report=term-missing \ + --cov-report=xml:coverage.xml \ + --cov-fail-under=20 + + - name: Upload coverage artifact + if: matrix.python-version == '3.12' + uses: actions/upload-artifact@v5 + with: + name: coverage-report + path: coverage.xml + retention-days: 7 + + # --------------------------------------------------------------------------- + # Build verification (ensures the package builds cleanly) + # --------------------------------------------------------------------------- + build-check: + name: "Build verification" + needs: test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + with: + persist-credentials: false + + - uses: actions/setup-python@v6 + with: + python-version: "3.12" + cache: pip + + - name: Install build tools + run: pip install build twine + + - name: Build distributions + run: python -m build + + - name: Check distributions + run: twine check dist/* + + - name: Verify package metadata + run: | + pip install dist/*.whl + python -c "import explainflow; print(f'✓ explainflow {explainflow.__version__} installed successfully')" diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..f6a2fd4 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,55 @@ +# ============================================================================= +# ExplainFlow — CodeQL Security Analysis +# ============================================================================= +# Runs GitHub's CodeQL semantic analysis engine to find security +# vulnerabilities in your Python code. Free for public repositories. +# +# Schedule: weekly + every push/PR to main. +# ============================================================================= + +name: "CodeQL" + +on: + push: + branches: [main] + pull_request: + branches: [main] + schedule: + # Run every Monday at 06:00 UTC + - cron: "0 6 * * 1" + +concurrency: + group: codeql-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + analyze: + name: Analyze (Python) + runs-on: ubuntu-latest + permissions: + security-events: write # Required for CodeQL to upload results + contents: read + actions: read + strategy: + fail-fast: false + matrix: + language: ["python"] + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v4 + with: + languages: ${{ matrix.language }} + + # Python is an interpreted language — no build step required. + # CodeQL will auto-detect the source layout. + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v4 + with: + category: "/language:${{ matrix.language }}" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..d8d7541 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,168 @@ +# ============================================================================= +# ExplainFlow — Release & Publish to PyPI +# ============================================================================= +# Triggered by pushing a version tag (v*.*.*). +# Uses PyPI Trusted Publishing (OIDC) — no API tokens needed. +# +# Prerequisites (one-time setup): +# 1. Go to https://pypi.org/manage/account/publishing/ +# 2. Add a "pending publisher": +# • PyPI project name: explainflow +# • Owner: DevaVirathan +# • Repository: explainflow +# • Workflow name: release.yml +# • Environment: pypi +# 3. In your GitHub repo → Settings → Environments: +# • Create "pypi" environment with required reviewers (recommended) +# • Create "testpypi" environment (no reviewers needed) +# +# Repeat step 2 on https://test.pypi.org with environment "testpypi". +# ============================================================================= + +name: Release + +on: + push: + tags: + - "v*.*.*" + +permissions: + contents: read + +jobs: + # --------------------------------------------------------------------------- + # Run full test suite before publishing + # --------------------------------------------------------------------------- + test: + name: "Pre-release tests" + runs-on: ubuntu-latest + strategy: + fail-fast: true + matrix: + python-version: ["3.9", "3.12"] + steps: + - uses: actions/checkout@v6 + with: + persist-credentials: false + + - uses: actions/setup-python@v6 + with: + python-version: ${{ matrix.python-version }} + cache: pip + cache-dependency-path: pyproject.toml + + - name: Install dependencies + run: pip install -e ".[all]" + + - name: Run tests + run: pytest tests/ -v --tb=short + + # --------------------------------------------------------------------------- + # Build distribution packages + # --------------------------------------------------------------------------- + build: + name: "Build distribution 📦" + needs: test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + with: + persist-credentials: false + + - uses: actions/setup-python@v6 + with: + python-version: "3.12" + + - name: Install build tools + run: python -m pip install build --user + + - name: Build sdist and wheel + run: python -m build + + - name: Verify distributions + run: | + pip install twine + twine check dist/* + + - name: Store distribution packages + uses: actions/upload-artifact@v5 + with: + name: python-package-distributions + path: dist/ + + # --------------------------------------------------------------------------- + # Publish to TestPyPI (every tag push) + # --------------------------------------------------------------------------- + publish-to-testpypi: + name: "Publish to TestPyPI 🧪" + needs: build + runs-on: ubuntu-latest + environment: + name: testpypi + url: https://test.pypi.org/p/explainflow + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + steps: + - name: Download distributions + uses: actions/download-artifact@v6 + with: + name: python-package-distributions + path: dist/ + + - name: Publish to TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ + + # --------------------------------------------------------------------------- + # Publish to PyPI (only tag pushes, after TestPyPI succeeds) + # --------------------------------------------------------------------------- + publish-to-pypi: + name: "Publish to PyPI 🚀" + needs: publish-to-testpypi + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/explainflow + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + steps: + - name: Download distributions + uses: actions/download-artifact@v6 + with: + name: python-package-distributions + path: dist/ + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + + # --------------------------------------------------------------------------- + # Create GitHub Release with auto-generated notes + # --------------------------------------------------------------------------- + github-release: + name: "GitHub Release 📝" + needs: publish-to-pypi + runs-on: ubuntu-latest + permissions: + contents: write # Required to create releases + steps: + - uses: actions/checkout@v6 + with: + persist-credentials: false + + - name: Download distributions + uses: actions/download-artifact@v6 + with: + name: python-package-distributions + path: dist/ + + - name: Create GitHub Release + env: + GITHUB_TOKEN: ${{ github.token }} + run: >- + gh release create + "${{ github.ref_name }}" + dist/* + --repo "${{ github.repository }}" + --generate-notes + --title "ExplainFlow ${{ github.ref_name }}" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f277553..8a84078 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,7 +6,7 @@ Thank you for your interest in contributing to ExplainFlow! 🎉 1. Clone the repository: ```bash -git clone https://github.com/yourusername/explainflow.git +git clone https://github.com/DevaVirathan/explainflow.git cd explainflow ``` diff --git a/ROADMAP.md b/ROADMAP.md index a589d9c..355cb76 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -107,57 +107,57 @@ temp_filename = os.path.join(tempfile.gettempdir(), f"explainflow_frame_{i}.png" ## 📋 Implementation Roadmap ### Phase 1: Bug Fixes & Quick Wins (v0.2.0) -- [ ] Fix @trace decorator double execution -- [ ] Fix Windows temp file path -- [ ] Fix HTML escaping -- [ ] Implement video export (MP4) -- [ ] Add Windows font fallbacks +- [x] Fix @trace decorator double execution +- [x] Fix Windows temp file path +- [x] Fix HTML escaping +- [x] Implement video export (MP4) +- [x] Add Windows font fallbacks -**Target Release:** v0.2.0 +**Target Release:** v0.2.0 ✅ COMPLETE --- ### Phase 2: Core Visualization (v0.3.0) -- [ ] Memory/Heap diagram visualization -- [ ] Object reference arrows -- [ ] Data structure diagrams (lists, dicts) -- [ ] Object ID tracking -- [ ] Improved variable display for complex types +- [x] Memory/Heap diagram visualization +- [x] Object reference arrows +- [x] Data structure diagrams (lists, dicts) +- [x] Object ID tracking +- [x] Improved variable display for complex types -**Target Release:** v0.3.0 +**Target Release:** v0.3.0 ✅ COMPLETE --- ### Phase 3: Enhanced Interactivity (v0.4.0) -- [ ] Call stack visualization -- [ ] Step backward support -- [ ] Breakpoints -- [ ] Improved exception flow visualization -- [ ] Loop iteration counter +- [x] Call stack visualization +- [x] Step backward support +- [x] Breakpoints +- [x] Improved exception flow visualization +- [x] Loop iteration counter -**Target Release:** v0.4.0 +**Target Release:** v0.4.0 ✅ COMPLETE --- ### Phase 4: Integrations (v0.5.0) -- [ ] Jupyter Notebook integration -- [ ] Live web interface (WebSocket-based) -- [ ] Async/generator support -- [ ] Context manager tracing +- [x] Jupyter Notebook integration +- [x] Live web interface (WebSocket-based) +- [x] Async/generator support +- [x] Context manager tracing -**Target Release:** v0.5.0 +**Target Release:** v0.5.0 ✅ COMPLETE --- ### Phase 5: Polish (v1.0.0) -- [ ] VSCode extension -- [ ] Multi-file tracing -- [ ] Custom themes -- [ ] Special type support (NumPy, Pandas) -- [ ] Comprehensive documentation site -- [ ] Performance optimizations - -**Target Release:** v1.0.0 +- [x] VSCode extension +- [x] Multi-file tracing +- [x] Custom themes +- [x] Special type support (NumPy, Pandas) +- [x] Comprehensive documentation site +- [x] Performance optimizations + +**Target Release:** v1.0.0 ✅ COMPLETE --- diff --git a/merge_sort_trace.html b/merge_sort_trace.html new file mode 100644 index 0000000..a7c0b91 --- /dev/null +++ b/merge_sort_trace.html @@ -0,0 +1,324 @@ + + +
+ + +Code Execution Trace
+Code Execution Trace
- +