bettere2b


Namebettere2b JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://github.com/playauraai/bettere2b
SummaryBetterE2B - Drop-in replacement for e2b-code-interpreter with dynamic subdomain support
upload_time2025-09-13 05:30:51
maintainerNone
docs_urlNone
authorYour Name
requires_python>=3.8
licenseMIT
keywords e2b sandbox code-execution docker subdomain dynamic sdk api python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ๐ŸŽฏ BetterE2B SDK

**Drop-in replacement for @e2b/code-interpreter with dynamic subdomain support!**

## ๐Ÿš€ Features

- โœ… **100% E2B Compatible** - Same API as official E2B
- โœ… **Dynamic Subdomains** - `https://{port}-{id}.yourdomain.com`
- โœ… **Path-based Routing** - `yourdomain.com/{port}-{id}/`
- โœ… **JavaScript/TypeScript SDK** - `bettere2b`
- โœ… **Python SDK** - `bettere2b`
- โœ… **Auto-managed Lifecycle** - Context managers and cleanup
- โœ… **No API Key Required** - Works out of the box

## ๐Ÿ“ฆ Installation

### JavaScript/TypeScript

```bash
npm install bettere2b
```

### Python

```bash
pip install bettere2b
```

## ๐ŸŽฏ Quick Start

### JavaScript/TypeScript

```javascript
import { Sandbox } from 'bettere2b'

const sandbox = await Sandbox.create()
await sandbox.runCode('x = 1')

const execution = await sandbox.runCode('x+=1; x')
console.log(execution.text)  // outputs 2

// Get dynamic subdomain URL
console.log(sandbox.getSubdomainUrl()) // https://8083-uuid.yourdomain.com

await sandbox.kill()
```

### Python

```python
from bettere2b import Sandbox

with Sandbox.create() as sandbox:
    sandbox.run_code("x = 1")
    execution = sandbox.run_code("x+=1; x")
    print(execution.text)  # outputs 2
    
    # Get dynamic subdomain URL
    print(sandbox.get_subdomain_url())  # https://8083-uuid.yourdomain.com
```

## ๐Ÿ”„ Migration from Official E2B

**Replace this:**
```javascript
import { Sandbox } from '@e2b/code-interpreter'
```

**With this:**
```javascript
import { Sandbox } from 'bettere2b'
```

**That's it!** Your existing code will work without any changes.

## ๐ŸŒ Dynamic Subdomain Features

### Get Subdomain URL
```javascript
const sandbox = await Sandbox.create()
const subdomainUrl = sandbox.getSubdomainUrl()
// Returns: https://8083-uuid.yourdomain.com
```

### Get Path-based URL
```javascript
const pathUrl = sandbox.getPathUrl()
// Returns: https://yourdomain.com/8083-uuid/
```

### Get Subdomain Configuration
```javascript
const config = await sandbox.getSubdomainConfig()
console.log(config.urls.subdomain)  // Full subdomain URL
console.log(config.urls.path)       // Path-based URL
```

## ๐Ÿ“š API Reference

### Sandbox Methods

| Method | Description | E2B Compatible |
|--------|-------------|----------------|
| `Sandbox.create(options)` | Create new sandbox | โœ… |
| `sandbox.runCode(code, language)` | Execute code | โœ… |
| `sandbox.kill()` | Terminate sandbox | โœ… |
| `sandbox.getHost(port)` | Get host URL | โœ… |
| `sandbox.install(packages, manager)` | Install packages | โœ… |
| `sandbox.writeFile(path, content)` | Write file | โœ… |
| `sandbox.readFile(path)` | Read file | โœ… |
| `sandbox.listFiles(directory)` | List files | โœ… |
| `sandbox.setTimeout(ms)` | Set timeout | โœ… |
| `sandbox.extendTimeout(ms)` | Extend timeout | โœ… |
| `sandbox.getSubdomainUrl()` | Get subdomain URL | ๐Ÿ†• |
| `sandbox.getPathUrl()` | Get path URL | ๐Ÿ†• |
| `sandbox.getSubdomainConfig()` | Get subdomain config | ๐Ÿ†• |

### ExecutionResult

```javascript
const result = await sandbox.runCode('print("Hello")')
console.log(result.text)        // Output text
console.log(result.logs.stdout) // stdout logs
console.log(result.logs.stderr) // stderr logs
console.log(result.error)       // Error message
console.log(result.exitCode)    // Exit code
console.log(result.executionTime) // Execution time
```

## ๐Ÿ”ง Configuration

### Server URL
```javascript
const sandbox = await Sandbox.create({
  serverUrl: 'http://localhost:8083'  // Your E2B clone server
})
```

### API Key (Optional)
```javascript
const sandbox = await Sandbox.create({
  apiKey: 'your-api-key'  // If your server requires authentication
})
```

### Runtime Options
```javascript
const sandbox = await Sandbox.create({
  name: 'My Sandbox',
  runtime: 'react',  // static, react, python, nextjs, etc.
  description: 'My custom sandbox',
  timeout: 60 * 60 * 1000  // 1 hour timeout
})
```

## ๐Ÿงช Testing

### JavaScript
```bash
cd server/sdk/javascript
npm test
```

### Python
```bash
cd server/sdk/python
python test.py
```

## ๐Ÿ†š Comparison with Official E2B

| Feature | Official E2B | Your E2B Clone |
|---------|--------------|----------------|
| Sandbox Creation | โœ… | โœ… |
| Code Execution | โœ… | โœ… |
| File Operations | โœ… | โœ… |
| Package Installation | โœ… | โœ… |
| Timeout Management | โœ… | โœ… |
| Dynamic Subdomains | โŒ | โœ… |
| Path-based Routing | โŒ | โœ… |
| Self-hosted | โœ… | โœ… |
| No API Key Required | โŒ | โœ… |
| Free to Use | โŒ | โœ… |

## ๐Ÿš€ Advanced Features

### Context Manager (Python)
```python
with Sandbox.create() as sandbox:
    result = sandbox.run_code('print("Hello")')
    # Sandbox automatically killed when exiting context
```

### Quick Create Function
```python
from your_e2b_clone import create_sandbox

sandbox = create_sandbox(name='Quick Test')
```

### Multiple Language Support
```javascript
// Python
await sandbox.runCode('print("Hello")', 'python')

// JavaScript
await sandbox.runCode('console.log("Hello")', 'javascript')

// Bash
await sandbox.runCode('echo "Hello"', 'bash')
```

## ๐Ÿ”— Links

- **Server Repository**: [Your E2B Clone Server](https://github.com/yourusername/your-e2b-clone)
- **Documentation**: [API Docs](https://yourdomain.com/docs)
- **Issues**: [GitHub Issues](https://github.com/yourusername/your-e2b-clone-sdk/issues)

## ๐Ÿ“„ License

MIT License - see [LICENSE](LICENSE) file for details.

## ๐Ÿค Contributing

Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

---

**Made with โค๏ธ - Your E2B Clone SDK**

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/playauraai/bettere2b",
    "name": "bettere2b",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "Your Name <your.email@example.com>",
    "keywords": "e2b, sandbox, code-execution, docker, subdomain, dynamic, sdk, api, python",
    "author": "Your Name",
    "author_email": "Your Name <your.email@example.com>",
    "download_url": "https://files.pythonhosted.org/packages/d0/2c/fef34d2a79a76d3c87691b502ec5ac302cf3c5f73605729924308ef3678e/bettere2b-1.0.0.tar.gz",
    "platform": null,
    "description": "# \ud83c\udfaf BetterE2B SDK\r\n\r\n**Drop-in replacement for @e2b/code-interpreter with dynamic subdomain support!**\r\n\r\n## \ud83d\ude80 Features\r\n\r\n- \u2705 **100% E2B Compatible** - Same API as official E2B\r\n- \u2705 **Dynamic Subdomains** - `https://{port}-{id}.yourdomain.com`\r\n- \u2705 **Path-based Routing** - `yourdomain.com/{port}-{id}/`\r\n- \u2705 **JavaScript/TypeScript SDK** - `bettere2b`\r\n- \u2705 **Python SDK** - `bettere2b`\r\n- \u2705 **Auto-managed Lifecycle** - Context managers and cleanup\r\n- \u2705 **No API Key Required** - Works out of the box\r\n\r\n## \ud83d\udce6 Installation\r\n\r\n### JavaScript/TypeScript\r\n\r\n```bash\r\nnpm install bettere2b\r\n```\r\n\r\n### Python\r\n\r\n```bash\r\npip install bettere2b\r\n```\r\n\r\n## \ud83c\udfaf Quick Start\r\n\r\n### JavaScript/TypeScript\r\n\r\n```javascript\r\nimport { Sandbox } from 'bettere2b'\r\n\r\nconst sandbox = await Sandbox.create()\r\nawait sandbox.runCode('x = 1')\r\n\r\nconst execution = await sandbox.runCode('x+=1; x')\r\nconsole.log(execution.text)  // outputs 2\r\n\r\n// Get dynamic subdomain URL\r\nconsole.log(sandbox.getSubdomainUrl()) // https://8083-uuid.yourdomain.com\r\n\r\nawait sandbox.kill()\r\n```\r\n\r\n### Python\r\n\r\n```python\r\nfrom bettere2b import Sandbox\r\n\r\nwith Sandbox.create() as sandbox:\r\n    sandbox.run_code(\"x = 1\")\r\n    execution = sandbox.run_code(\"x+=1; x\")\r\n    print(execution.text)  # outputs 2\r\n    \r\n    # Get dynamic subdomain URL\r\n    print(sandbox.get_subdomain_url())  # https://8083-uuid.yourdomain.com\r\n```\r\n\r\n## \ud83d\udd04 Migration from Official E2B\r\n\r\n**Replace this:**\r\n```javascript\r\nimport { Sandbox } from '@e2b/code-interpreter'\r\n```\r\n\r\n**With this:**\r\n```javascript\r\nimport { Sandbox } from 'bettere2b'\r\n```\r\n\r\n**That's it!** Your existing code will work without any changes.\r\n\r\n## \ud83c\udf10 Dynamic Subdomain Features\r\n\r\n### Get Subdomain URL\r\n```javascript\r\nconst sandbox = await Sandbox.create()\r\nconst subdomainUrl = sandbox.getSubdomainUrl()\r\n// Returns: https://8083-uuid.yourdomain.com\r\n```\r\n\r\n### Get Path-based URL\r\n```javascript\r\nconst pathUrl = sandbox.getPathUrl()\r\n// Returns: https://yourdomain.com/8083-uuid/\r\n```\r\n\r\n### Get Subdomain Configuration\r\n```javascript\r\nconst config = await sandbox.getSubdomainConfig()\r\nconsole.log(config.urls.subdomain)  // Full subdomain URL\r\nconsole.log(config.urls.path)       // Path-based URL\r\n```\r\n\r\n## \ud83d\udcda API Reference\r\n\r\n### Sandbox Methods\r\n\r\n| Method | Description | E2B Compatible |\r\n|--------|-------------|----------------|\r\n| `Sandbox.create(options)` | Create new sandbox | \u2705 |\r\n| `sandbox.runCode(code, language)` | Execute code | \u2705 |\r\n| `sandbox.kill()` | Terminate sandbox | \u2705 |\r\n| `sandbox.getHost(port)` | Get host URL | \u2705 |\r\n| `sandbox.install(packages, manager)` | Install packages | \u2705 |\r\n| `sandbox.writeFile(path, content)` | Write file | \u2705 |\r\n| `sandbox.readFile(path)` | Read file | \u2705 |\r\n| `sandbox.listFiles(directory)` | List files | \u2705 |\r\n| `sandbox.setTimeout(ms)` | Set timeout | \u2705 |\r\n| `sandbox.extendTimeout(ms)` | Extend timeout | \u2705 |\r\n| `sandbox.getSubdomainUrl()` | Get subdomain URL | \ud83c\udd95 |\r\n| `sandbox.getPathUrl()` | Get path URL | \ud83c\udd95 |\r\n| `sandbox.getSubdomainConfig()` | Get subdomain config | \ud83c\udd95 |\r\n\r\n### ExecutionResult\r\n\r\n```javascript\r\nconst result = await sandbox.runCode('print(\"Hello\")')\r\nconsole.log(result.text)        // Output text\r\nconsole.log(result.logs.stdout) // stdout logs\r\nconsole.log(result.logs.stderr) // stderr logs\r\nconsole.log(result.error)       // Error message\r\nconsole.log(result.exitCode)    // Exit code\r\nconsole.log(result.executionTime) // Execution time\r\n```\r\n\r\n## \ud83d\udd27 Configuration\r\n\r\n### Server URL\r\n```javascript\r\nconst sandbox = await Sandbox.create({\r\n  serverUrl: 'http://localhost:8083'  // Your E2B clone server\r\n})\r\n```\r\n\r\n### API Key (Optional)\r\n```javascript\r\nconst sandbox = await Sandbox.create({\r\n  apiKey: 'your-api-key'  // If your server requires authentication\r\n})\r\n```\r\n\r\n### Runtime Options\r\n```javascript\r\nconst sandbox = await Sandbox.create({\r\n  name: 'My Sandbox',\r\n  runtime: 'react',  // static, react, python, nextjs, etc.\r\n  description: 'My custom sandbox',\r\n  timeout: 60 * 60 * 1000  // 1 hour timeout\r\n})\r\n```\r\n\r\n## \ud83e\uddea Testing\r\n\r\n### JavaScript\r\n```bash\r\ncd server/sdk/javascript\r\nnpm test\r\n```\r\n\r\n### Python\r\n```bash\r\ncd server/sdk/python\r\npython test.py\r\n```\r\n\r\n## \ud83c\udd9a Comparison with Official E2B\r\n\r\n| Feature | Official E2B | Your E2B Clone |\r\n|---------|--------------|----------------|\r\n| Sandbox Creation | \u2705 | \u2705 |\r\n| Code Execution | \u2705 | \u2705 |\r\n| File Operations | \u2705 | \u2705 |\r\n| Package Installation | \u2705 | \u2705 |\r\n| Timeout Management | \u2705 | \u2705 |\r\n| Dynamic Subdomains | \u274c | \u2705 |\r\n| Path-based Routing | \u274c | \u2705 |\r\n| Self-hosted | \u2705 | \u2705 |\r\n| No API Key Required | \u274c | \u2705 |\r\n| Free to Use | \u274c | \u2705 |\r\n\r\n## \ud83d\ude80 Advanced Features\r\n\r\n### Context Manager (Python)\r\n```python\r\nwith Sandbox.create() as sandbox:\r\n    result = sandbox.run_code('print(\"Hello\")')\r\n    # Sandbox automatically killed when exiting context\r\n```\r\n\r\n### Quick Create Function\r\n```python\r\nfrom your_e2b_clone import create_sandbox\r\n\r\nsandbox = create_sandbox(name='Quick Test')\r\n```\r\n\r\n### Multiple Language Support\r\n```javascript\r\n// Python\r\nawait sandbox.runCode('print(\"Hello\")', 'python')\r\n\r\n// JavaScript\r\nawait sandbox.runCode('console.log(\"Hello\")', 'javascript')\r\n\r\n// Bash\r\nawait sandbox.runCode('echo \"Hello\"', 'bash')\r\n```\r\n\r\n## \ud83d\udd17 Links\r\n\r\n- **Server Repository**: [Your E2B Clone Server](https://github.com/yourusername/your-e2b-clone)\r\n- **Documentation**: [API Docs](https://yourdomain.com/docs)\r\n- **Issues**: [GitHub Issues](https://github.com/yourusername/your-e2b-clone-sdk/issues)\r\n\r\n## \ud83d\udcc4 License\r\n\r\nMIT License - see [LICENSE](LICENSE) file for details.\r\n\r\n## \ud83e\udd1d Contributing\r\n\r\nContributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.\r\n\r\n---\r\n\r\n**Made with \u2764\ufe0f - Your E2B Clone SDK**\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "BetterE2B - Drop-in replacement for e2b-code-interpreter with dynamic subdomain support",
    "version": "1.0.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/playauraai/bettere2b/issues",
        "Documentation": "https://github.com/playauraai/bettere2b#readme",
        "Homepage": "https://github.com/playauraai/bettere2b",
        "Repository": "https://github.com/playauraai/bettere2b"
    },
    "split_keywords": [
        "e2b",
        " sandbox",
        " code-execution",
        " docker",
        " subdomain",
        " dynamic",
        " sdk",
        " api",
        " python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c45122d0e2d25f6b4bb2033cf73293958fb56f0f8fd7571a2f766efb99ca5dd2",
                "md5": "79ed185e0e6c68cd612eee1eaac380d0",
                "sha256": "4a46f07c7ed28e7238df0ed4d8fa4f5c181a8e80c5b0094be62af7f0211c2ad4"
            },
            "downloads": -1,
            "filename": "bettere2b-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "79ed185e0e6c68cd612eee1eaac380d0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 6714,
            "upload_time": "2025-09-13T05:30:49",
            "upload_time_iso_8601": "2025-09-13T05:30:49.761075Z",
            "url": "https://files.pythonhosted.org/packages/c4/51/22d0e2d25f6b4bb2033cf73293958fb56f0f8fd7571a2f766efb99ca5dd2/bettere2b-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d02cfef34d2a79a76d3c87691b502ec5ac302cf3c5f73605729924308ef3678e",
                "md5": "f7dab352c23bd23e8e89664b6ab52d1c",
                "sha256": "2f84df3cb41998f82e88589b29615ea3d1654b627b9b7da588065c42cbe1d17f"
            },
            "downloads": -1,
            "filename": "bettere2b-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "f7dab352c23bd23e8e89664b6ab52d1c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 11022,
            "upload_time": "2025-09-13T05:30:51",
            "upload_time_iso_8601": "2025-09-13T05:30:51.286505Z",
            "url": "https://files.pythonhosted.org/packages/d0/2c/fef34d2a79a76d3c87691b502ec5ac302cf3c5f73605729924308ef3678e/bettere2b-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-13 05:30:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "playauraai",
    "github_project": "bettere2b",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "bettere2b"
}
        
Elapsed time: 2.95459s