Skip to main content

A Python SDK by Akash Halder for compiling and executing code online with beautiful CLI output.

Project description

ah_code_compiler_banner_img

Python Version Website

A lightweight Python SDK to compile and execute code using a powerful code-execution API. Perfect for building online code editors, testing environments, and educational platforms.

A Python port of the original TypeScript SDK

🎯 Try the live demo here: https://www.akashhalder.in/code-compiler


✨ Features

  • Fetch supported runtimes with versions
  • Execute code in 50+ programming languages
  • Beautiful CLI output
  • Intelligent error and warning formatting
  • Easy-to-use abstraction via AHCodeCompiler class
  • Built-in compiler.help() method for usage reference

📦 Installation

pip install AHCodeCompiler

🚀 Usage (Python)

from AHCodeCompiler import AHCodeCompiler

compiler = AHCodeCompiler()

# Get all Runtimes
compiler.get_runtimes()

# Execute Code via this method
compiler.execute(
    language="javascript",
    files=[
        {
            "name": "main.js", 
            "content": "console.log('🔥 Hello!')"
        }
    ]
)

# Get usage help
compiler.help()

📚 API Reference

class AHCodeCompiler

Main SDK wrapper for all functionality.

get_runtimes() -> List[Dict]

Fetch all supported runtimes (languages + versions).

execute(language: str, version: str = None, files: List[Dict[str, str]]) -> Dict

Execute code using the given language, version, and files.

Auto-detects version if not provided.

compiler.execute(
    language="python",
    files=[{"name": "main.py", "content": "print('Hello World')"}]
)

help()

Print a beautiful CLI-style usage guide right in your terminal.

🧪 Advanced CLI Output

  • ✅ Success Panels (Green)
  • ⚠️ Stderr Panels (Yellow/Red with colorized error/warning lines)
  • ⛔ Error Panels (if execution fails)

🌍 Supported Languages

Some popular languages include:

  • Python (python3)
  • JavaScript (node)
  • C++
  • Java
  • Go
  • Rust
  • TypeScript
  • C#
  • Ruby
  • PHP
  • ...and many more!

Use compiler.get_runtimes() to fetch the full, up-to-date list.


🧠 Why Use This?

  • Makes building compilers, online editors, judge systems easy
  • Just plug & play, no complex setup
  • Clean abstraction for both beginners & advanced devs
  • Same SDK is available in TypeScript

📄 License

MIT License © Akash Halder

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ahcodecompiler-1.0.4.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ahcodecompiler-1.0.4-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file ahcodecompiler-1.0.4.tar.gz.

File metadata

  • Download URL: ahcodecompiler-1.0.4.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for ahcodecompiler-1.0.4.tar.gz
Algorithm Hash digest
SHA256 2101221ae0929e46d3b105e658bfcffe5654fab72e8db74a1c51d2a9b42b81d0
MD5 5f39364571cd5fc321994c5c237083f0
BLAKE2b-256 618005b6a1f8d413d9bb6b56e0258dbe7705ebc41834fd2394d709a25490e37b

See more details on using hashes here.

File details

Details for the file ahcodecompiler-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: ahcodecompiler-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for ahcodecompiler-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a8fc0943e6c0ab31cf713268ad7cc8e94d5deedf4e389727b5ab7b9d42b605f8
MD5 091afe6745f08a17e9cc7e1e61b36a87
BLAKE2b-256 f00df6ca5b9c6b05b4f82679687628bccc9ae8c21328ad647e655e2815ebbe66

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page