Skip to content

Conversation

ganeshrvel
Copy link
Collaborator

Problem Statement

What we're trying to solve:

  • Python project generates local output files that need visual inspection
  • Users need a simple CLI command (load-webview) to instantly view these files in a web interface
  • Want to ship React frontend + Python backend as a single pip-installable package
  • Need both development mode (separate servers) and production mode (bundled React served by Python)

The Architecture:
pip install my-project

my-project generates local files

load-webview # Single CLI command

Launches: Python API server + React frontend

User opens browser → Views local files via web interface

How we're solving it:

  1. Bundled Distribution Strategy:
    - Development: React dev server (port 3000) + Python API (port 8000) running separately
    - Production: React app pre-built into static files, served by Python server
    - Single pip package contains both frontend bundle and Python backend
  2. CLI Workflow: # User installs package pip install my-project

User generates files with main project

my-project --input data.json --output results/

User views results in browser

load-webview --data-dir results/

→ Opens http://localhost:8000 with React app

  1. Build Pipeline:
    - scripts/build.py: Builds React app → js-bundle/ directory
    - scripts/dev.py: Runs both servers for development
    - Package includes pre-built React bundle for production
    - CLI automatically serves bundled frontend if available
  2. Technical Implementation:
    - Frontend: React + TypeScript for file visualization (tables, charts, etc.)
    - Backend: FastAPI with file reading APIs (/api/datasets, /api/files)
    - Development: Auto-reload on code changes, CORS configured
    - Production: Static file serving, SPA routing, single server

   Problem Statement

  What we're trying to solve:
  - Python project generates local output files that need visual inspection
  - Users need a simple CLI command (load-webview) to instantly view these files
   in a web interface
  - Want to ship React frontend + Python backend as a single pip-installable
  package
  - Need both development mode (separate servers) and production mode (bundled
  React served by Python)

  The Architecture:
  pip install my-project
  ↓
  my-project generates local files
  ↓
  load-webview  # Single CLI command
  ↓
  Launches: Python API server + React frontend
  ↓
  User opens browser → Views local files via web interface

  How we're solving it:

  1. Bundled Distribution Strategy:
    - Development: React dev server (port 3000) + Python API (port 8000) running
   separately
    - Production: React app pre-built into static files, served by Python server
    - Single pip package contains both frontend bundle and Python backend
  2. CLI Workflow:
  # User installs package
  pip install my-project

  # User generates files with main project
  my-project --input data.json --output results/

  # User views results in browser
  load-webview --data-dir results/
  # → Opens http://localhost:8000 with React app
  3. Build Pipeline:
    - scripts/build.py: Builds React app → js-bundle/ directory
    - scripts/dev.py: Runs both servers for development
    - Package includes pre-built React bundle for production
    - CLI automatically serves bundled frontend if available
  4. Technical Implementation:
    - Frontend: React + TypeScript for file visualization (tables, charts, etc.)
    - Backend: FastAPI with file reading APIs (/api/datasets, /api/files)
    - Development: Auto-reload on code changes, CORS configured
    - Production: Static file serving, SPA routing, single server
@dosubot dosubot bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Jul 14, 2025
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Summary

This PR introduces a new feature to add a web-based visualization interface for Ragas evaluation results through a bundled React webview CLI. The implementation allows users to view local evaluation files through a browser with a simple CLI command.

The changes introduce:

  • A Python FastAPI backend that serves both API endpoints and static files
  • A React frontend with TypeScript and TailwindCSS for visualization
  • Development mode with separate servers and hot-reload
  • Production mode where React is pre-built and served by Python

However, there are several critical issues that need addressing:

  1. The package.json specifies non-existent future versions of dependencies (React 19.1.0, TailwindCSS 4.0.0)
  2. The datasets.py service has hardcoded paths and ignores the data_dir parameter
  3. Bundle validation in bundle.py could be more robust

Confidence score: 2/5

  1. This PR will likely cause immediate dependency and runtime issues if merged
  2. The dependency versions and hardcoded paths make this PR unstable and potentially broken
  3. Files needing attention:
    • webview-poc/ragas-webview/package.json (invalid dependency versions)
    • webview-poc/ragas_webview_cli/services/datasets.py (hardcoded paths)
    • webview-poc/ragas_webview_cli/services/bundle.py (validation logic)

30 files reviewed, 19 comments
Edit PR Review Bot Settings | Greptile

@ganeshrvel ganeshrvel changed the title feat: Add bundled React webview CLI for local file visualization feat: Add bundled React webview CLI for local file visualization [wip] Jul 23, 2025
@ganeshrvel ganeshrvel marked this pull request as draft July 23, 2025 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:XXL This PR changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant