https://github.com/biru-codeastromer/py2cpp
Python → C++ converter for competitive programming. React + FastAPI + Ollama (Qwen). Side-by-side run, compile-repair loop, CF boilerplate.
https://github.com/biru-codeastromer/py2cpp
ai-codegen cloudflare-tunnel codeforces competitive-programming fastapi ollama python-to-cpp qwen react vitejs
Last synced: 3 months ago
JSON representation
Python → C++ converter for competitive programming. React + FastAPI + Ollama (Qwen). Side-by-side run, compile-repair loop, CF boilerplate.
- Host: GitHub
- URL: https://github.com/biru-codeastromer/py2cpp
- Owner: biru-codeastromer
- Created: 2025-08-12T21:26:09.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-08-12T22:54:24.000Z (11 months ago)
- Last Synced: 2025-08-12T23:32:19.000Z (11 months ago)
- Topics: ai-codegen, cloudflare-tunnel, codeforces, competitive-programming, fastapi, ollama, python-to-cpp, qwen, react, vitejs
- Language: Python
- Homepage: https://py2cpp.vercel.app/
- Size: 48.8 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# py2cpp — AI Python → C++ (CF-ready)
[](https://py2cpp.vercel.app/)




**py2cpp** converts Python to C++17 with a Codeforces-style boilerplate, then compiles and runs both versions side-by-side on the same input.
AI-first: Qwen2.5-Coder (via Ollama) + a compile-and-repair loop.
**Live UI:** https://py2cpp.vercel.app/
---
## Requirements
- macOS with Homebrew
- Python 3.10+, Node 18+
- Ollama installed
---
## Quick start
1) **Model server**
```bash
brew install ollama cloudflare/cloudflare/cloudflared
ollama serve
ollama pull qwen2.5-coder:7b
```
2) **Backend**
```bash
cd backend
python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
export OLLAMA_MODEL=qwen2.5-coder:7b
uvicorn main:app --host 0.0.0.0 --port 8000
```
3) **Frontend**
```bash
cd frontend
echo "VITE_API_URL=https://.trycloudflare.com" > .env
npm install && npm run dev
```
> The frontend is static. The backend (FastAPI + Ollama + g++) runs on your machine and must stay running.
4) **Public URL**
```bash
cloudflared tunnel --url http://localhost:8000
# copy the https://.trycloudflare.com URL
```
### Notes: Deployment can be only for frontend via netlify or vercel ; backend would be running locally constantly to work
## API
- POST /ai/convert → body { "py": "" } → { "cpp": "" }
- POST /run/python → { "code": "", "stdin": "" }
- POST /run/cpp → { "code": "", "stdin": "" }
- GET /healthz → { "ok": true }
### Key points:
- macOS/Clang is handled by a fallback header set when is unavailable.
- Targeted at contest-style Python; highly dynamic features may require manual edits.
### License
MIT © Birajit Saikia