Skip to content

whiterabb17/py2go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Py2Go — Converter + Dashboard

This package contains:

  • cli/py2go_converter.go — standalone CLI tool to convert Python files to Go using OpenAI or Ollama.
  • backend/main.go — HTTP server that manages jobs, uses the CLI if present, serves the dashboard.
  • frontend/index.html and frontend/static/App.jsx — React + Tailwind web UI.

Quickstart

  1. Build the CLI (optional, server can run fallback):
cd cli
go build -o ../py2go_converter py2go_converter.go
cd ..
  1. Run the backend server:
go run backend/main.go -addr :8080 -out ./server_out -workers 2 -ollama-model qwen2.5-coder:1.5b -openai-key sk-proj-......

Notes:

  • Ensure go and gofmt are installed and on PATH for validation.
  • Configure OpenAI API key via OPENAI_API_KEY env if using OpenAI engine and not providing it as a CLI argument.
  • For Ollama, provide -ollama-url and -ollama-model flags to the CLI or set in backend options.
  • the test directory contains a python script that can be used for testing
  • Ensure py2go_converter is in the root of the backend server or wherever you start the backend from

Tested Models

  • Local LLMs:

  • qwen2.5-coder:1.5b (results sometimes need a small amount of fixing but results aren't bad)

  • OpenAI:

  • gpt-4o-mini

  • gpt-5-nano

Built Project Directory Structure:

  • backend.exe
  • dist/ (containing the built frontend)
  • py2go_converter (CLI tools)
  • configs/ (containing agents.yaml config file) [if using the agent backend]

UI

Screenshot

Agent Demo

Agent-based backend

Features

  • Self-healing (conversion iterations include errors so agent has better context for the next attempt)
  • Dynamically creates agent tasks based on the files in the provided workspace.
  • Memory injection of current file, conversion errors and other workspace files.
  • Code usually comes back correctly but not always extracted and formatted from the response correctly.

TODO

  • add automatic go format and build validation

A new backend variant using github.com/Ingenimax/agent-sdk-go agent has been added under backend-agent/. Run it with:

go run backend-agent/main.go -addr :8081 -out ./server_out_agent -workers 1 -ollama-model localModelAvailable -openai-key sk-proj-.....

The agent supports OpenAI (via OPENAI_API_KEY) and Ollama (provide ollama_url and ollama_model in options payload of job creation).

About

A python to go converter with the help of LLMs. Supports Ollama and OpenAI. CLI & UI

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published