A side-by-side comparison of popular programming languages. Compare syntax and concepts across 21+ programming languages including Python, JavaScript, Rust, Java, Go, and more.
π Live Site: https://prog-lang-compare.netlify.app
- π 21+ Programming Languages: Compare syntax across Python, JavaScript, Rust, Java, Go, TypeScript, Ruby, Swift, Kotlin, and more
- π 108+ Programming Concepts: From basic datatypes to advanced concepts
- π¨ Modern UI: Dark mode support with beautiful syntax highlighting
- π€ AI-Generated Content: All explanations generated using OpenAI API
- β‘ 2,500+ Static Pages: SEO-optimized for search engines
- π± Fully Responsive: Works great on mobile, tablet, and desktop
- Python 3.11+
- Node.js 18+ (for JavaScript tests)
- OpenAI API key (for content generation)
-
Clone the repository:
git clone https://github.com/srix/prog-lang-compare.git cd prog-lang-compare -
Set up Python environment:
# Using uv (recommended) uv venv .venv-3.11 --python 3.11 source .venv-3.11/bin/activate uv pip install -r requirements.txt # Or using standard pip python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate pip install -r requirements.txt
-
Configure API keys:
cp .env.example .env # Edit .env and add your OpenAI API credentials -
Build the site:
./build.sh
-
Preview locally:
cd docs && python -m http.server 8000 # Visit http://localhost:8000
Run tests for builder scripts:
# Activate virtual environment first
source .venv-3.11/bin/activate
# Run all tests
pytest
# Run with coverage
pytest --cov=builder --cov-report=html
# Run specific test file
pytest tests/test_helper.py
# View coverage report
open htmlcov/index.htmlCurrent Test Coverage:
- β 17 tests passing
- β
100% coverage on
plccache.py - β
89% coverage on
helper.py
Run tests for frontend code:
# Install dependencies
npm install
# Run all tests
npm test
# Run with coverage
npm run test:coverage
# Run in watch mode
npm run test:watchSee TESTING.md for detailed testing documentation.
.
βββ builder/ # Python build scripts
β βββ main.py # AI content generator
β βββ generate_static_pages.py
β βββ generate_sitemap.py
β βββ helper.py # Utility functions
β βββ plccache.py # Cache management
βββ docs/ # GitHub Pages deployment
β βββ index.html # Main page
β βββ script.js # Frontend JavaScript
β βββ styles.css # Styling
β βββ prog_lang_concepts.yaml
β βββ prog_langs.yaml
β βββ concepts/ # 2,500+ static pages
βββ tests/ # Python tests
β βββ test_helper.py
β βββ test_plccache.py
βββ __tests__/ # JavaScript tests
β βββ script.test.js
βββ build.sh # One-command build script
βββ requirements.txt # Python dependencies
βββ package.json # JavaScript dependencies
βββ TESTING.md # Testing guide
-
Edit
docs/prog_lang_concepts.yaml:NewCategory: NewConcept: "Explain {concept} in {lang} with examples."
-
Run the builder:
python builder/main.py
-
Generate static pages:
python builder/generate_static_pages.py
-
Or use the all-in-one script:
./build.sh
-
Edit
docs/prog_langs.yaml:Programming Languages: - Python 3.10 - Your New Language
-
Rebuild:
./build.sh
prog_lang_concepts.yaml + prog_langs.yaml
β
builder/main.py (OpenAI API + caching)
β
docs/content-autogen/gpt_3_5_turbo/{language}.json
β
builder/generate_static_pages.py
β
docs/concepts/{language}/{concept}.html (2,500+ pages)
β
builder/generate_sitemap.py
β
docs/sitemap.xml
- Smart Caching: Only regenerates content when prompts change
- Concurrent API Calls: Parallel processing for faster generation
- SEO Optimized: Meta tags, structured data, sitemap
- Responsive Design: Mobile-first with dark mode
- Syntax Highlighting: Custom themes for light and dark modes
- Python 3.11: Build scripts
- OpenAI API: Content generation
- PyYAML: Configuration management
- pytest: Testing framework
- Vanilla JavaScript: No framework dependencies
- jQuery & DataTables: Interactive comparison table
- Highlight.js: Syntax highlighting
- Marked.js: Markdown rendering
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests (
pytest && npm test) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Write tests for new utility functions
- Maintain >80% code coverage
- Run
pytestbefore committing - See TESTING.md for detailed guidelines
Licensed under the Apache License 2.0. See LICENSE for details.
- Content generated using OpenAI API
- UI inspired by modern developer tools
- Community contributions and feedback
- π Live Website
- π¦ GitHub Repository
- π Report Issues
- π Testing Guide
Made with β€οΈ by the Programming Language Comparison community