Code Interpreter Library
Project description
Cillow is an open-source library that enables you to execute AI-generated code in a controlled environment. The name "Cillow" follows the same naming convention as "Pillow" (Python Imaging Library), representing its role as a Code Interpreter Library.
It offers key features such as:
- Environment Switching: Effortlessly switch between multiple Python environments.
- Automated Package Installation: Automatically install imported packages using
uvorpip. - Functionality Patches: Apply patches to restrict the scope of AI-generated code, capture outputs such as
stdout,stderr, images, plots, and more.
Check Documentation
Visit synacktra.is-a.dev/cillow
Installation
pip install cillow
Hosting a server
import cillow
cillow.add_patches(
cillow.prebuilt_patches.patch_stdout_stderr_write,
cillow.prebuilt_patches.patch_matplotlib_pyplot_show,
cillow.prebuilt_patches.patch_pillow_show,
)
if __name__ == "__main__":
server = cillow.Server(
port=5556, max_interpreters=2, interpreters_per_client=1
)
server.run()
Running code through a client
import cillow
client = cillow.Client.new(host="127.0.0.1", port=5556)
client.run_code("""
from PIL import Image, ImageDraw
img = Image.new('RGB', (400, 300), 'white')
draw = ImageDraw.Draw(img)
draw.rectangle([50, 50, 350, 250], outline='black', width=3)
draw.ellipse([100, 100, 300, 200], outline='purple', width=3)
draw.line([50, 250, 350, 250], fill='blue', width=3)
img.show()
""")
At the moment, Cillow only supports Python, as it does not rely on Jupyter Kernel/Lab.
This project began as an exploration of E2B's code interpreter. I implemented the Python interpreter from scratch, taking a different approach by adding features like environment switching and functionality patching. Recognizing the potential of the project, I expanded it into a client-server architecture using ZeroMQ, threading, and multiprocessing.
Project details
Release history Release notifications | RSS feed
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 cillow-1.0.0.tar.gz.
File metadata
- Download URL: cillow-1.0.0.tar.gz
- Upload date:
- Size: 31.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b33c3d4e77b3019620d770e1599a3a1925c1b7e67cefa182f06432f162fbe8c8
|
|
| MD5 |
8d4d6f6b0dbbc8dee42b91a4a74c3700
|
|
| BLAKE2b-256 |
9c6d9eb0e128c255d5bb317b903ebb3351a5b19e13abb9720036bbb8a1a7e992
|
File details
Details for the file cillow-1.0.0-py3-none-any.whl.
File metadata
- Download URL: cillow-1.0.0-py3-none-any.whl
- Upload date:
- Size: 26.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8673b51f8bd7c328a6030d45d168df66b8a81d750936a3ca9b5033474e170c15
|
|
| MD5 |
38f2af2d72731e42fc9966f206dd057a
|
|
| BLAKE2b-256 |
1e101a8c1b74a7e970ea4ecdb6d89a18a0a39129a76556b9da64db958dae39b4
|