codejail-includes
raw JSON → 2.0.0 verified Fri May 01 auth: no python
A library providing safe includes for Python sandboxed execution via CodeJail. Version 2.0.0 supports Python >=3.11 and is maintained under the Open edX organization. It extracts and packages the includes previously embedded in edx-platform, allowing reuse in sandboxed code.
pip install codejail-includes Common errors
error ModuleNotFoundError: No module named 'codejail.includes' ↓
cause Using the old import path from the original edx-platform package.
fix
Change import to 'from codejail_includes import safe_import_or_exec'.
error ImportError: cannot import name 'safe_import_or_exec' from 'codejail_includes' ↓
cause Missing package or incorrect symbol name; package may not be installed.
fix
Run 'pip install codejail-includes' and verify the symbol exists in the module.
Warnings
breaking Import path changed: use 'codejail_includes' not 'codejail.includes'. ↓
fix Update imports to 'from codejail_includes import ...'.
gotcha Requires Python >=3.11; does not support older Python versions. ↓
fix Upgrade Python to >=3.11 or pin to an older version if available.
Imports
- safe_import_or_exec wrong
from codejail.includes import safe_import_or_execcorrectfrom codejail_includes import safe_import_or_exec
Quickstart
from codejail_includes import safe_import_or_exec
# Example: safely import a module
result = safe_import_or_exec('math', 'sqrt(16)')
print(result) # Output: 4.0