Skip to main content

cillow logo gif


cillow version cillow CI status cillow codecov cillow license

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 uv or pip.
  • 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.

Metadata

Release files for cillow 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cillow 1.0.0
File Size Uploaded Provenance Actions
cillow-1.0.0.tar.gz 31.7 kB Without provenance Details for cillow-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cillow 1.0.0
File Interpreter ABI Platform Actions
cillow-1.0.0-py3-none-any.whl Python 3 none any Details for cillow-1.0.0-py3-none-any.whl

Total release size: 58.1 kB

Release files / cillow-1.0.0.tar.gz

Download URL cillow-1.0.0.tar.gz
Size 31.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b33c3d4e77b3019620d770e1599a3a1925c1b7e67cefa182f06432f162fbe8c8
BLAKE2b-256 checksum
How to use checksums
9c6d9eb0e128c255d5bb317b903ebb3351a5b19e13abb9720036bbb8a1a7e992
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Release files / cillow-1.0.0-py3-none-any.whl

Download URL cillow-1.0.0-py3-none-any.whl
Size 26.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8673b51f8bd7c328a6030d45d168df66b8a81d750936a3ca9b5033474e170c15
BLAKE2b-256 checksum
How to use checksums
1e101a8c1b74a7e970ea4ecdb6d89a18a0a39129a76556b9da64db958dae39b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Security for cillow 1.0.0

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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page