A universal compiler and interpreter wrapper that detects programming languages by file extension and executes them with the appropriate toolchain.
🎉 Version 1.1.0 - Improved UX!
- 🌍 30+ Languages - Python, JavaScript, Go, Java, C, C++, Rust, Ruby, PHP, and more
- 🔍 Auto-Detection - Automatically detects language from file extension
- 📦 Auto-Install - Installs missing toolchains via system package manager
- ⚙️ Configurable - Global and per-project configuration
- 👀 Watch Mode - Auto-rerun on file changes
- 🎨 Colored Output - Beautiful terminal output with progress indicators
- 🔧 Custom Extensions - Map any extension to any language
- 🚀 Fast - Minimal overhead, efficient execution
- 🐳 Docker Ready - Pre-built images with common runtimes
- 📚 Well Documented - Comprehensive guides and examples
Quick Install (one-liner):
curl -sSL https://raw.githubusercontent.com/velo4705/polyglot/main/scripts/install.sh | bashOr install from source:
git clone https://github.com/velo4705/polyglot.git
cd polyglot
make build
sudo make installDocker:
git clone https://github.com/velo4705/polyglot.git
cd polyglot
docker build -t polyglot .
# Run a file
docker run -v $(pwd):/workspace polyglot -h# Run any supported file
polyglot run hello.py
polyglot run main.go
polyglot run app.js
# Watch mode (auto-rerun on changes)
polyglot watch hello.py
# Dry run (see what would execute)
polyglot run --dry-run hello.c
# List supported languages
polyglot list
# Check installed toolchains
polyglot check
# Update to latest version
polyglot update
# Show version
polyglot version- Quick Start Guide - Get started in 5 minutes
- Configuration Guide - Complete configuration reference
- Language Support - All 30+ supported languages
- Examples - Comprehensive usage examples
- Architecture - System design and internals
- Contributing - How to contribute
- FAQ - Frequently asked questions
Python • JavaScript • Ruby • PHP • Perl • Lua • Shell • Elixir • Erlang • Groovy • R • Julia • Haskell • OCaml • TypeScript • Dart
Go • Java • C • C++ • Rust • Zig • Nim • Crystal • D • Haskell • OCaml • F# • Kotlin • Scala • Swift
Brainfuck
Total: 30 languages with 45+ file extensions
# Python
$ polyglot run hello.py
ℹ Detected: Python
→ Executing: python3 hello.py
Hello from Python!
# Go
$ polyglot run main.go
ℹ Detected: Go
→ Executing: go run main.go
Hello from Go!
# C (with compilation)
$ polyglot run hello.c
ℹ Detected: C
→ Compiling hello.c...
✓ Compilation successful
→ Executing: ./hello
Hello from C!$ polyglot watch app.js
👀 Watching app.js for changes...
→ Executing: node app.js
Server running on port 3000
# Edit file and save...
🔄 File changed: app.js
──────────
→ Executing: node app.js
Server running on port 3000
✓ Completed in 45ms# .polyglot.yaml
languages:
python:
command: python3.11
flags:
- "-O"
environment:
PYTHONPATH: "./lib"
custom_extensions:
.pyx: Python
.jsx: JavaScript
environment:
NODE_ENV: "development"- Rapid Prototyping - Test code in any language instantly
- Learning - Experiment with new languages easily
- Polyglot Projects - Work with multiple languages seamlessly
- CI/CD - Run tests in any language
- Automation - Script in your preferred language
- Deployment - Execute deployment scripts
- Teaching - Support students using different languages
- Assignments - Grade code in any language
- Workshops - Quick setup for participants
# Initialize config
polyglot config init
# Enable auto-install
polyglot config set auto_install.enabled true
# Set Python version
polyglot config set languages.python.version 3.11Create .polyglot.yaml in your project:
auto_install:
enabled: true
prompt: false
languages:
python:
enabled: true
version: "3.11"
javascript:
enabled: true
environment:
NODE_ENV: "development"
custom_extensions:
.pyx: Python
.jsx: JavaScriptPolyglot comes with Docker support including common language runtimes.
# Clone the repository first
git clone https://github.com/velo4705/polyglot.git
cd polyglot
# Build the image
docker build -t polyglot .Run files from your current directory:
# Create a test file
echo 'print("Hello from Docker!")' > hello.py
# Run it with polyglot in Docker
docker run -v $(pwd):/workspace polyglot run hello.py
# Run JavaScript
echo 'console.log("Hello from Docker!");' > hello.js
docker run -v $(pwd):/workspace polyglot run hello.js
# Run with arguments
docker run -v $(pwd):/workspace polyglot run script.py arg1 arg2Interactive shell with all languages:
# Start development container
docker-compose up -d polyglot-dev
docker-compose exec polyglot-dev bash
# Now you're inside the container with all languages available
polyglot list
polyglot run hello.py
exitQuick commands:
# List supported languages
docker run polyglot list
# Check version
docker run polyglot version
# Get help
docker run polyglot --helpThe Docker image includes: Python, Node.js, Ruby, PHP, Perl, Lua, Bash, GCC, G++, and Go.
- Detection: <1ms
- Python Execution: ~50ms
- Go Execution: ~200ms (includes compilation)
- Config Load: <5ms
- Memory: ~10MB base
# Run all tests
./scripts/run-tests.sh
# Unit tests only
go test ./internal/... ./pkg/... -v
# Integration tests
go test ./test/... -v
# Benchmarks
go test ./test/... -bench=. -benchmemTest Coverage: 85%+
We welcome contributions! See CONTRIBUTING.md for guidelines.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Add tests
- Run tests (
./scripts/run-tests.sh) - Commit (
git commit -m 'Add amazing feature') - Push (
git push origin feature/amazing-feature) - Open a Pull Request
See CONTRIBUTING.md for detailed instructions.
MIT License - see LICENSE file for details.
If you find Polyglot useful, please consider giving it a star! ⭐
Made with ❤️ by the Polyglot community
Version: 1.0.0 | Status: Production Ready | License: MIT