Catalog PyPI
PACKAGE EXPLORERView in registry

AHCodeCompiler

PyPI

A powerful Python SDK and interactive CLI editor by Akash Halder for compiling and executing code with rich terminal output and supports for 30+ programming languages.

Versions collected1
Direct dependencies4From release 1.0.6
Last observed21 Oct, 09:36 UTC

README

Version 1.0.6 documentation
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 30+ 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
  • Bonus: Comes with a ready-to-use CLI code editor (editor.start())

💡CLI Editor Demo


📦 Installation

pip install ahcodecompiler

# In Jupyter notebook / lab or Google Collab
!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()

🖥️ Interactive CLI Code Editor

This SDK ships with an ready to use CLI-based code editor and runner which internally uses the same AHCodeCompiler class.

Usage:

from AHCodeCompiler import Editor

Editor.start()

What It Does??

  • Prompts user to select a language
  • Loads available runtimes from the API
  • Accepts multiline code input
  • Automatically detects appropriate filename
  • Displays output and error in styled CLI format

📚 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

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
1.0.610 Jun 20264

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 09:36 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:f2728a37c8049346c491117bcdef36bd73b0f2cc59fc3739d1ce3df5da9b7171