Skip to content

Commit 7646d19

Browse files
committed
Merge remote-tracking branch 'origin/main' into frontend-eslint
# Conflicts: # .github/workflows/ci.yml # README.md
2 parents c551622 + 663a0da commit 7646d19

File tree

9 files changed

+2126
-69
lines changed

9 files changed

+2126
-69
lines changed

.github/workflows/ci.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,41 @@ on:
66
pull_request:
77

88
jobs:
9+
check-lockfile:
10+
name: Check backend lockfile is up to date
11+
if: github.event_name == 'pull_request'
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
- name: Ensure lockfiles are updated when .in files change
18+
run: |
19+
BASE=${{ github.event.pull_request.base.sha }}
20+
HEAD=${{ github.event.pull_request.head.sha }}
21+
CHANGED=$(git diff --name-only "$BASE" "$HEAD")
22+
FAIL=0
23+
if echo "$CHANGED" | grep -q 'backend/requirements\.in$'; then
24+
if ! echo "$CHANGED" | grep -q 'backend/requirements\.txt$'; then
25+
echo "::error::backend/requirements.in was modified but backend/requirements.txt was not."
26+
FAIL=1
27+
fi
28+
if ! echo "$CHANGED" | grep -q 'backend/requirements-dev\.txt$'; then
29+
echo "::error::backend/requirements.in was modified but backend/requirements-dev.txt was not."
30+
FAIL=1
31+
fi
32+
fi
33+
if echo "$CHANGED" | grep -q 'backend/requirements-dev\.in$'; then
34+
if ! echo "$CHANGED" | grep -q 'backend/requirements-dev\.txt$'; then
35+
echo "::error::backend/requirements-dev.in was modified but backend/requirements-dev.txt was not."
36+
FAIL=1
37+
fi
38+
fi
39+
if [ "$FAIL" -eq 1 ]; then
40+
echo "::error::Please run pip-compile to regenerate lockfiles. See README for instructions."
41+
exit 1
42+
fi
43+
944
frontend-lint:
1045
name: Frontend Lint & Typecheck
1146
runs-on: ubuntu-latest

README.md

Lines changed: 46 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,30 +13,24 @@ This project consists of three main components:
1313
## Quick Start
1414

1515
### Prerequisites
16-
- Python 3.8+
17-
- Node.js 16+
18-
- CPython source repository (for benchmarking)
16+
- Docker Engine 20.10+ and Docker Compose 2.0+
17+
- CPython source repository (for benchmarking with the worker)
1918

2019
### Setup & Installation
2120
```bash
22-
# Install all dependencies and set up database
23-
make setup
21+
# Copy environment config
22+
cp .env.example .env
2423

25-
# Or install components separately
26-
make install # Install frontend + backend dependencies
27-
make init-db # Initialize SQLite database
28-
make populate-db # Add mock data for development
24+
# Build and start all services
25+
docker compose -f docker-compose.dev.yml up --build
2926
```
3027

3128
### Development
32-
```bash
33-
# Start both frontend and backend servers
34-
make dev
3529

36-
# Or start them individually
37-
make dev-frontend # Frontend on http://localhost:9002
38-
make dev-backend # Backend API on http://localhost:8000
39-
```
30+
Services start automatically with hot reload:
31+
- Frontend: http://localhost:9002
32+
- Backend API: http://localhost:8000
33+
- API Documentation: http://localhost:8000/api/docs
4034

4135
## Development Commands
4236

@@ -53,16 +47,23 @@ npm run typecheck # TypeScript type checking
5347

5448
Both checks run in CI on pushes to `main` and on pull requests.
5549

56-
### Database Management
50+
### Populating Mock Data
5751
```bash
58-
make reset-db # Drop and recreate database with fresh data
59-
make populate-db # Add mock benchmark data
52+
docker compose -f docker-compose.dev.yml exec backend python scripts/populate_db.py
6053
```
6154

62-
### Production
55+
### Updating Backend Dependencies
6356
```bash
64-
make build # Build frontend for production
65-
make clean # Clean up generated files and caches
57+
# Edit backend/requirements.in, then regenerate both lockfiles:
58+
docker run --rm -v "$(pwd)/backend:/app" -w /app python:3.13-slim-bookworm \
59+
sh -c "pip install --quiet pip-tools && \
60+
pip-compile --strip-extras --generate-hashes \
61+
--output-file requirements.txt requirements.in && \
62+
pip-compile --strip-extras --generate-hashes \
63+
--output-file requirements-dev.txt requirements-dev.in"
64+
65+
# Rebuild the backend container:
66+
docker compose -f docker-compose.dev.yml up --build -d backend
6667
```
6768

6869
## Worker Setup
@@ -98,10 +99,30 @@ memory-tracker benchmark /path/to/cpython HEAD~5..HEAD \
9899

99100
```bash
100101
# Development with hot reload
101-
docker-compose -f docker-compose.dev.yml up
102+
docker compose -f docker-compose.dev.yml up
102103

103104
# Production deployment
104-
docker-compose up
105+
docker compose up
106+
```
107+
108+
## Local Development (not recommended)
109+
110+
Running services directly on the host is possible but not recommended.
111+
Docker Compose ensures consistent Python/Node versions, database setup,
112+
and dependency isolation across all platforms.
113+
114+
### Prerequisites
115+
- Python 3.13+
116+
- Node.js 20+
117+
118+
```bash
119+
make setup # Install deps, init DB, populate mock data
120+
make dev # Start frontend + backend with hot reload
121+
make test # Run backend tests
122+
make reset-db # Drop and recreate database with fresh data
123+
make populate-db # Populate the DB with mock data
124+
make build # Build frontend for production
125+
make clean # Clean up generated files and caches
105126
```
106127

107128
## Usage Examples
@@ -137,7 +158,7 @@ memory-tracker benchmark ~/cpython HEAD~10..HEAD \
137158
## Contributing
138159

139160
1. Follow the existing code style and conventions
140-
2. Run tests before committing: `make test`
161+
2. Run tests before committing
141162
3. Use TypeScript for all frontend code
142163
4. Follow the repository patterns for new features
143164
5. Never commit secrets or authentication tokens

backend/Dockerfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ RUN apt-get update && apt-get install -y \
1212
# Copy requirements first to leverage Docker layer caching
1313
COPY requirements.txt .
1414

15-
# Install PostgreSQL adapter
16-
RUN pip install --no-cache-dir asyncpg psycopg2-binary
17-
1815
# Install Python dependencies
1916
RUN pip install --no-cache-dir -r requirements.txt
2017

backend/Dockerfile.dev

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.11-slim
1+
FROM python:3.13-slim-bookworm
22

33
WORKDIR /app
44

@@ -7,10 +7,10 @@ RUN apt-get update && apt-get install -y \
77
gcc \
88
&& rm -rf /var/lib/apt/lists/*
99

10-
COPY requirements.txt .
10+
COPY requirements-dev.txt .
1111

12-
# Install Python dependencies
13-
RUN pip install --no-cache-dir -r requirements.txt
12+
# Install Python dependencies (dev lockfile includes test tooling)
13+
RUN pip install --no-cache-dir -r requirements-dev.txt
1414

1515
# The source code will be mounted as a volume, so we don't copy it here
1616

backend/requirements-dev.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-r requirements.in
2+
pytest
3+
pytest-asyncio

0 commit comments

Comments
 (0)