|
| 1 | +# Contributing to HyperView |
| 2 | + |
| 3 | +We welcome contributions! This guide will help you set up your development environment and submit high-quality pull requests. |
| 4 | + |
| 5 | +## Development Setup |
| 6 | + |
| 7 | +### Requirements |
| 8 | +- **Python 3.10+** |
| 9 | +- **uv** (Package manager) |
| 10 | +- **Node.js** (For frontend development) |
| 11 | + |
| 12 | +### One-time Setup |
| 13 | +Clone the repo and install dependencies: |
| 14 | + |
| 15 | +```bash |
| 16 | +git clone https://github.com/Hyper3Labs/HyperView.git |
| 17 | +cd HyperView |
| 18 | + |
| 19 | +# Create virtual environment and install dev dependencies |
| 20 | +uv venv .venv |
| 21 | +source .venv/bin/activate |
| 22 | +uv pip install -e ".[dev]" |
| 23 | + |
| 24 | +# Install frontend dependencies |
| 25 | +cd frontend |
| 26 | +npm install |
| 27 | +cd .. |
| 28 | +``` |
| 29 | + |
| 30 | +## Running Locally |
| 31 | + |
| 32 | +For the best development experience, run the backend and frontend in separate terminals. |
| 33 | + |
| 34 | +### 1. Start the Backend |
| 35 | +Runs the Python API server at `http://127.0.0.1:6262`. |
| 36 | + |
| 37 | +```bash |
| 38 | +uv run hyperview demo --samples 200 --no-browser |
| 39 | +``` |
| 40 | + |
| 41 | +_Tip: Use `HF_DATASETS_OFFLINE=1` if you have cached datasets and want to work offline._ |
| 42 | + |
| 43 | +### 2. Start the Frontend |
| 44 | +Runs the Next.js dev server at `http://127.0.0.1:3000` with hot reloading. |
| 45 | + |
| 46 | +```bash |
| 47 | +cd frontend |
| 48 | +npm run dev |
| 49 | +``` |
| 50 | + |
| 51 | +The frontend automatically proxies API requests (`/api/*`) to the backend. |
| 52 | + |
| 53 | +## Common Tasks |
| 54 | + |
| 55 | +### Testing & Linting |
| 56 | +Please ensure all checks pass before submitting a PR. |
| 57 | + |
| 58 | +```bash |
| 59 | +# Python |
| 60 | +uv run pytest # Run unit tests |
| 61 | +uv run ruff format . # formatting |
| 62 | +uv run ruff check . --fix # Linting |
| 63 | + |
| 64 | +# Frontend |
| 65 | +cd frontend |
| 66 | +npm run lint |
| 67 | +``` |
| 68 | + |
| 69 | +### Exporting the Frontend |
| 70 | +The Python package bundles the compiled frontend. If you modify the frontend, you must regenerate the static assets so they can be served by the Python backend in production/demos. |
| 71 | + |
| 72 | +```bash |
| 73 | +bash scripts/export_frontend.sh |
| 74 | +``` |
| 75 | +_This compiles the frontend and places artifacts into `src/hyperview/server/static/`. Do not edit files in that directory manually._ |
| 76 | + |
| 77 | +## Pull Request Guidelines |
| 78 | + |
| 79 | +1. **Scope**: Keep changes focused. Open an issue first for major refactors or new features. |
| 80 | +2. **Tests**: Add tests for new logic where practical. |
| 81 | +3. **Visuals**: If changing the UI, please attach a screenshot or GIF to your PR. |
| 82 | +4. **Format**: Ensure code is formatted with `ruff` (Python) and `prettier` (JS/TS implicit in `npm run lint`). |
0 commit comments