Registry / devops / edx-codejail

edx-codejail

JSON →
library4.1.0pypypi✓ verified 81d ago

CodeJail manages execution of untrusted code in secure sandboxes. It is designed primarily for Python execution, but can be used for other languages as well. The current version is 4.1.0, released May 2025. Release cadence is irregular, approximately 2-3 minor versions per year.

pip install edx-codejail
INSTALL
IMPORT
SIG · EDX-CODEJAIL
E
edx-codejail
devopspythonv4.1.0
Install
1.6s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v4.1.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.000s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

CodeJail
import codejail
from codejail import CodeJail

Basic usage: configure a jail and execute untrusted code safely.

from codejail.jail import CodeJail from codejail.safe_exec import safe_exec # Configure a Python jail (requires proper system setup) jail = CodeJail('python', user='sandbox', sys_packages=['/usr/bin/python3']) # Use safe_exec for quick sandboxed execution result = safe_exec("print(1+1)", globals=globals(), python_path='/usr/bin/python3') print(result)
Debug
Known issues
breakingIn v4.0.0, 'unsafe execution' now requires explicit opt-in via calling code rather than being allowed by default. Code that relied on the old behavior will raise an error.
fix
Update code to handle cases where execution is blocked, or explicitly configure the jail to allow unsafe operations if needed.
affects: >=4.0.0
gotchaCodeJail requires root or specific user privileges to set up AppArmor profiles. Running without proper system configuration will cause silent failures.
fix
Ensure AppArmor is installed and the codejail profile is loaded. Run as root or use appropriate sudo.
affects: >=3.0.0
gotchaThe safe_exec function does not capture stdout/stderr; it returns a dictionary with 'status', 'stderr', etc. New users often expect print() output to appear.
fix
Use jail.run() for more control or parse the returned dict.
affects: all
deprecatedUsing 'sys_packages' argument to CodeJail is deprecated. Use 'python_path' instead.
fix
Replace sys_packages with python_path in CodeJail constructor.
affects: >=4.0.0
Upgrade
Version history
4.1.0latest on PyPI · released Nov 7, 2025
Audit
Dependencies
apparmoroptionalUsed for sandboxing on Linux (AppArmor profile required for secure execution)
setuptoolsrequiredRequired at runtime for safe exec compilation
Agent activity
26 hits · last 30 days
node
24
OpenAI (training)
1
Resources
edx-codejail — pip install edx-codejail · libregistry