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
AHCodeCompilerclass - 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
Metadata
Release files for AHCodeCompiler 1.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ahcodecompiler-1.0.6.tar.gz | 12.4 kB | Without provenance | Details for ahcodecompiler-1.0.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ahcodecompiler-1.0.6-py3-none-any.whl | Python 3 | none | any | Details for ahcodecompiler-1.0.6-py3-none-any.whl |
Total release size: 25.8 kB
Release files / ahcodecompiler-1.0.6.tar.gz
| Download URL | ahcodecompiler-1.0.6.tar.gz |
|---|---|
| Size | 12.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
140675143c12e860f85d341aa2a115a23bd6814bbdef4854eca6388c2e941575
|
|
BLAKE2b-256 checksum How to use checksums |
9d5a1988d1fe00caf947f8c49857d7a4b8ea8546fa6adcaf917465d1023a34b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / ahcodecompiler-1.0.6-py3-none-any.whl
| Download URL | ahcodecompiler-1.0.6-py3-none-any.whl |
|---|---|
| Size | 13.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9a44de3cb93a388a658655872eb51276eda4dac90ba5b3263549b2b50123bd75
|
|
BLAKE2b-256 checksum How to use checksums |
c498fa16f92ab1afa927b4dd32daefbf8a73726cb45ddb08e7dbd5d46735703d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Security for AHCodeCompiler 1.0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.