Table of contents
SDK v2 introduces several important changes:- New creation pattern in Python Synchronous SDK
- Secure by default
- Updated file operations in Python SDK
- Updated list method
Breaking changes
1. Sandbox creation in synchronous Python SDK
In v2, the synchronous Python SDK uses a class methodcreate() instead of the constructor Sandbox().
2. Secure communication by default
Sandboxes are now secure by default. That means you cannot access the sandbox controller directly via its URL without authentication header. SDK handles authentication header for you automatically. For custom templates created before envdv0.2.0, you need to rebuild the templates to enable secure communication,
otherwise you will receive error messages when creating sandboxes. You can check template envd version via e2b template list command or templates list in dashboard.
You can temporarily disable secure communication by setting secure to false during sandbox creation, but this is not recommended for production use.
3. File writing in Python SDK
The file writing API in Python has been made more consistent. In v2, usesandbox.files.write() for single files and sandbox.files.write_files() for multiple files:
write() method was overloaded for both single and multiple files: