diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..368e2f2 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,93 @@ +## Development + +#### Building from Source + +```bash +# Standard build (executor image pulled at runtime) +docker build -t code-interpreter -f code-interpreter/Dockerfile . + +# Build with pre-loaded executor image for instant DinD startup +./build-preloaded.sh code-interpreter:preloaded +``` + +**Build arguments:** +- `SKIP_NESTED_DOCKER=1` - Skip installing Docker entirely (only for Docker-out-of-Docker mode) +- `PYTHON_EXECUTOR_DOCKER_IMAGE=custom/image` - Use a custom executor image + +#### Pre-loaded Images for Faster Startup + +For production or offline environments, you can build an image with the executor pre-embedded: + +```bash +# Build pre-loaded image (includes executor, ~1GB larger but instant DinD startup) +./build-preloaded.sh code-interpreter:preloaded + +# Run with instant startup (no pulling needed) +docker run --rm -it \ + --privileged \ + -p 8000:8000 \ + code-interpreter:preloaded +``` + +This is ideal for: +- Production deployments (predictable startup times) +- Air-gapped/offline environments +- CI/CD pipelines +- Any scenario where you want instant DinD readiness + +### Local Deployment + +#### Prerequisites + +- Python 3.11 +- Docker (for execution isolation) +- [uv](https://github.com/astral-sh/uv) package manager (recommended) + +#### Running the Service + +```bash +# Clone the repository +git clone https://github.com/onyx-dot-app/code-interpreter.git +cd code-interpreter + +# Activate a virtual environment +python -m venv .venv +source .venv/bin/activate + +# Install dependencies +uv sync --locked +``` + +```bash +# Start the API server (defaults to 0.0.0.0:8000) +code-interpreter-api + +# Or specify host/port via environment variables +HOST=127.0.0.1 PORT=8080 code-interpreter-api +``` + +### Code Quality + +```bash +# Type checking (must pass strict mypy) +mypy . + +# Linting +ruff check . + +# Formatting +ruff format . + +# Run all pre-commit hooks +pre-commit run --all-files +``` + +### Testing + +```bash +# Run integration tests +pytest tests/integration_tests -q + +# Run a specific test +pytest tests/integration_tests/test_file.py::test_function_name -v +``` diff --git a/README.md b/README.md index f001f7b..fed0b62 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,11 @@ Everything runs locally and the execution environment comes pre-packaged with a This project aims to be the easiest, lightest weight way to add secure Python execution to your AI agent. +![Code Interpreter](code_interpreter_exp.png) + ## How it works -The security first architecture and an overview of the implementation can be found [here](https://github.com/onyx-dot-app/code-interpreter/blob/main/HOW_IT_WORKS.md). +The security first architecture and an overview of the implementation can be found [here](HOW_IT_WORKS.md). ## Quick Start @@ -61,7 +63,7 @@ docker run --rm -it \ ### Kubernetes Deployment -See [here](https://github.com/onyx-dot-app/code-interpreter/blob/main/kubernetes/code-interpreter/README.md) for Helm and K8s deployment instructions +See [here](kubernetes/code-interpreter/README.md) for Helm and K8s deployment instructions ## API Usage diff --git a/code_interpreter_exp.png b/code_interpreter_exp.png new file mode 100644 index 0000000..04469fb Binary files /dev/null and b/code_interpreter_exp.png differ