A Python SDK by Akash Halder for compiling and executing code online with beautiful CLI output.
Project description
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
AHCodeCompilerclass - 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ahcodecompiler-1.0.3.tar.gz.
File metadata
- Download URL: ahcodecompiler-1.0.3.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
37798723e336624ed9b3a5aa7ce95ead8a33082eac06f7d5abadcfb9d8b8e734
|
|
| MD5 |
22472b955c6d947d140a3d24e8c76a26
|
|
| BLAKE2b-256 |
d62c760f5b84f585bdf8a1e6677032c7f85bcf2f97932cc5822115c35c6b8cea
|
File details
Details for the file ahcodecompiler-1.0.3-py3-none-any.whl.
File metadata
- Download URL: ahcodecompiler-1.0.3-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ee422350b436ecfe1a54be53457d181468188f0dba678ada2255963afd4e66e
|
|
| MD5 |
02dd8b7170270d962d75dd6c03a18ffb
|
|
| BLAKE2b-256 |
2bdd8f9e0c093c91d9a298d5e399e2113e2ddec0538223ca69df65f33b6c6232
|