Commit Graph

235 Commits

Author SHA1 Message Date
Mish Ushakov 4a2a6c7051 Add Templates SDK (#871)
### Merge Templates SDK into E2B SDK.

This PR merges code from Templates SDK to E2B SDK.

**Changelog**

- Added new error classes: BuildError, FileUploadError.
- Added template API endpoints to API Client generation (Python).
- Updated API Clients error handling to throw BuildError in addition to
SandboxError.
- Exported Template and TemplateAsync classes.
- Moved `getRuntime` utility method from api to utils.
- Browser is supported except file operations (COPY). Incompatible
modules are not bundled, using dynamic imports (tar, glob) in supported
environments (Node, Deno, Bun) instead.
- Basic tests were added, subject to expansion in a follow-up PR.
- Breaking: Before, 401 error was raising `SandboxError`, which was
incorrect, now it will raise `AuthenticationError`. I have also changed
the `AuthenticationError` to extend Error class, not `SandboxError`
anymore as it's now thrown by both Sandbox and Template.

**Usage**

JavaScript

```js
import { Template } from 'e2b';

const template = Template()
  .fromImage('ubuntu:22.04')
  .copy('folder/*.txt', 'folder', { forceUpload: true })
  .setEnvs({
    ENV_1: 'value1',
    ENV_2: 'value2',
  })
  .runCmd('cat folder/test.txt')
  .setWorkdir('/app')
  .setStartCmd('echo "Hello, world!"', Template.waitForTimeout('10s'))

await Template.build(template, {
  alias: 'test-template',
  cpuCount: 1,
  memoryMB: 1024,
  onBuildLogs: (logEntry) => console.log(logEntry.toString()),
})

```

Python

```py
from e2b import Template

template = (
    Template()
    .from_image("ubuntu:22.04")
    .copy("folder/*.txt", "folder", force_upload=True)
    .set_envs(
        {
            "ENV_1": "value1",
            "ENV_2": "value2",
        }
    )
    .run_cmd("cat folder/test.txt")
    .set_workdir("/app")
    .set_start_cmd("echo 'Hello, world!'", Template.wait_for_timeout("10s"))
)

Template.build(
    template,
    alias="test-template",
    cpu_count=1,
    memory_mb=1024,
    on_build_logs=lambda log_entry: print(log_entry),
)
```

Python Async

```py
from e2b import AsyncTemplate

template = (
    AsyncTemplate()
    .from_image("ubuntu:22.04")
    .copy("folder/*.txt", "folder", force_upload=True)
    .set_envs(
        {
            "ENV_1": "value1",
            "ENV_2": "value2",
        }
    )
    .run_cmd("cat folder/test.txt")
    .set_workdir("/app")
    .set_start_cmd("echo 'Hello, world!'", Template.wait_for_timeout("10s"))
)

await AsyncTemplate.build(
    template,
    alias="test-template",
    cpu_count=1,
    memory_mb=1024,
    on_build_logs=lambda log_entry: print(log_entry),
)
```

---

Merge progress

- [x] JavaScript SDK
- [x] Python SDK
- [x] Tests
- [x] Split files for review
2025-09-05 22:00:22 +02:00
github-actions[bot] 2162c6191f [skip ci] Release new versions 2025-09-03 12:49:17 +00:00
github-actions[bot] 787a3192ce [skip ci] Release new versions 2025-09-03 12:01:10 +00:00
github-actions[bot] 4eb3a2d322 [skip ci] Release new versions 2025-08-21 20:08:42 +00:00
github-actions[bot] 774dfd7667 [skip ci] Release new versions 2025-08-21 15:51:16 +00:00
github-actions[bot] e140ec3717 [skip ci] Release new versions 2025-08-06 21:14:31 +00:00
github-actions[bot] 7540839268 [skip ci] Release new versions 2025-08-06 10:32:14 +00:00
github-actions[bot] 9d2b3c92a7 [skip ci] Release new versions 2025-08-04 12:40:16 +00:00
0div 4d7eda4f51 Sort SDK version for dropdown using semver package (#839)
Sorting the versions lexicographically was not ordering by latest
correctly, now using `semver` package to sort them:
```ts
> versions = [
  '1.9.0',  '1.8.0',
  '1.7.0',  '1.6.0',
  '1.5.0',  '1.4.0',
  '1.3.0',  '1.2.0',
  '1.12.0', '1.11.0',
  '1.10.0', '1.1.0',
  '1.0.0'
]

> versions.sort((a, b) => semver.rcompare(a, b))
[
  '1.12.0', '1.11.0',
  '1.10.0', '1.9.0',
  '1.8.0',  '1.7.0',
  '1.6.0',  '1.5.0',
  '1.4.0',  '1.3.0',
  '1.2.0',  '1.1.0',
  '1.0.0'
]
```
2025-07-31 14:01:15 -07:00
github-actions[bot] 115407cf1e [skip ci] Release new versions 2025-07-31 09:44:55 +00:00
github-actions[bot] 76d62ed070 [skip ci] Release new versions 2025-07-30 19:25:33 +00:00
github-actions[bot] 7f26f5536e [skip ci] Release new versions 2025-07-29 10:44:36 +00:00
github-actions[bot] 37d69be891 [skip ci] Release new versions 2025-07-28 15:23:07 +00:00
Jakub Novák 706ebd9af8 Fix generating files with docker (#829)
# Description

Fixes an issue in generating files in Docker. There has been an
incompatibility of `buf` (version `29.5`) and `protoc-gen-es` (version
`2.2.2`).

I updated `protoc-gen-es@` to `2.6.2`

Also refactored the code a little so it's easier to read
Added a CI pipeline job to check all files are properly generated
2025-07-28 13:47:26 +02:00
Jakub Novák 3b26f71b44 Update dependencies (#824)
# Description

Fixes: 
https://github.com/e2b-dev/E2B/security/dependabot/184
https://github.com/e2b-dev/E2B/security/dependabot/182
https://github.com/e2b-dev/E2B/security/dependabot/178
https://github.com/e2b-dev/E2B/security/dependabot/183
https://github.com/e2b-dev/E2B/security/dependabot/176
https://github.com/e2b-dev/E2B/security/dependabot/175
https://github.com/e2b-dev/E2B/security/dependabot/174
https://github.com/e2b-dev/E2B/security/dependabot/173
2025-07-24 06:21:03 -07:00
github-actions[bot] e7538fb5cc [skip ci] Release new versions 2025-07-18 11:20:02 +00:00
github-actions[bot] 5f207ffa95 [skip ci] Release new versions 2025-07-17 13:16:31 +00:00
github-actions[bot] 9704e2ff03 [skip ci] Release new versions 2025-06-24 17:08:34 +00:00
github-actions[bot] 884e6b3917 [skip ci] Release new versions 2025-06-23 16:58:16 +00:00
github-actions[bot] 40c73100bc [skip ci] Release new versions 2025-06-20 02:52:52 +00:00
Jakub Novák 4b85063919 Update deps (#788)
# Description

Fixes:
- https://github.com/e2b-dev/E2B/security/dependabot/169
- https://github.com/e2b-dev/E2B/security/dependabot/168
- https://github.com/e2b-dev/E2B/security/dependabot/164
2025-06-19 17:06:43 -07:00
github-actions[bot] 4aaeee2af4 [skip ci] Release new versions 2025-06-13 11:03:18 +00:00
Jakub Dobry e244ba72c0 Add option for a template ready check (#750)
## Description
Add option for a template ready check. You can specify `ready_cmd` which
will be run until it exits with code 0. Max timeout is 5 minutes. After
exit code 0, the template will be marked as ready.

If no ready command is defined, `sleep 20` is assumed when the start
command is present, and `sleep 0` when none is defined. It is also
possible to define ready command without any start command. This might
be helpful if the filesystem contains self-booted services (e.g. using
systemd).

```
ready_cmd = "echo 'Starting ready check'; sleep 40; echo 'Template is ready'"
```

This adds possibility to configure the default 20 seconds wait time for
a start command.

New documentation can be found at `/docs/sandbox-template/ready-cmd`.

## Checklist
- [x] Make sure the https://github.com/e2b-dev/infra/pull/719 is
deployed

---------

Co-authored-by: Vasek Mlejnsky <vasek@e2b.dev>
Co-authored-by: Jakub Novák <jakub@e2b.dev>
2025-06-12 17:42:37 -07:00
github-actions[bot] 6c0927e358 [skip ci] Release new versions 2025-06-05 14:15:25 +00:00
Mish Ushakov b21f86c543 Added lint workflow for JS, Python SDKs (#759)
- Linted all existing files
- Added GitHub workflow to check everything is linted correctly
2025-06-05 14:52:48 +02:00
github-actions[bot] f1afba0d74 [skip ci] Release new versions 2025-06-03 10:13:57 +00:00
Jakub Novák 2ab29f8fd0 [Dependencies] Update Vite (#751)
# Description

Fixes:
https://github.com/e2b-dev/E2B/security/dependabot/162
https://github.com/e2b-dev/E2B/security/dependabot/164
2025-06-02 02:49:47 -07:00
github-actions[bot] 286e70d689 [skip ci] Release new versions 2025-05-14 15:19:57 +00:00
Jakub Novák 3b87ed9087 Update dependencies (#720)
# Description

Fixes: 
https://github.com/e2b-dev/E2B/security/dependabot/149
https://github.com/e2b-dev/E2B/security/dependabot/150
2025-05-12 20:35:21 +00:00
github-actions[bot] 41f42a1490 [skip ci] Release new versions 2025-05-05 16:34:23 +00:00
github-actions[bot] 5cb2edc0d1 [skip ci] Release new versions 2025-04-29 15:28:51 +00:00
Jakub Novák 4ec6c82630 Security patches (#706)
# Description

Fixes:
https://github.com/e2b-dev/E2B/security/dependabot/163
https://github.com/e2b-dev/E2B/security/dependabot/157
https://github.com/e2b-dev/E2B/security/dependabot/156
https://github.com/e2b-dev/E2B/security/dependabot/148
https://github.com/e2b-dev/E2B/security/dependabot/147
2025-04-29 02:41:14 -07:00
github-actions[bot] 2822c7bec0 [skip ci] Release new versions 2025-04-10 16:09:43 +00:00
Jakub Novák 2aada562d1 Update esbuild to 0.25.0 (#673)
# Description

https://github.com/e2b-dev/E2B/security/dependabot/147
2025-04-07 15:54:56 +02:00
github-actions[bot] b02f93e7f4 [skip ci] Release new versions 2025-04-05 20:21:53 +00:00
github-actions[bot] ac81f95529 [skip ci] Release new versions 2025-04-05 19:43:23 +00:00
dependabot[bot] 0543c33363 Bump the npm_and_yarn group across 2 directories with 1 update (#658)
Bumps the npm_and_yarn group with 1 update in the / directory:
[next](https://github.com/vercel/next.js).
Bumps the npm_and_yarn group with 1 update in the /apps/web directory:
[next](https://github.com/vercel/next.js).

Updates `next` from 14.2.25 to 14.2.26
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/vercel/next.js/releases">next's
releases</a>.</em></p>
<blockquote>
<h2>v14.2.26</h2>
<blockquote>
<p>[!NOTE]<br />
This release is backporting bug fixes. It does <strong>not</strong>
include all pending features/changes on canary.</p>
</blockquote>
<h3>Core Changes</h3>
<ul>
<li>Match subrequest handling for edge and node (<a
href="https://redirect.github.com/vercel/next.js/issues/77476">#77476</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/vercel/next.js/commit/10a042cdca294fd1c6852b320954bc6ccc6064e7"><code>10a042c</code></a>
v14.2.26</li>
<li><a
href="https://github.com/vercel/next.js/commit/8a511d6a22d38132c79b8f70ee29713d42225802"><code>8a511d6</code></a>
Match subrequest handling for edge and node (<a
href="https://redirect.github.com/vercel/next.js/issues/77476">#77476</a>)</li>
<li>See full diff in <a
href="https://github.com/vercel/next.js/compare/v14.2.25...v14.2.26">compare
view</a></li>
</ul>
</details>
<br />

Updates `next` from 14.2.25 to 14.2.26
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/vercel/next.js/releases">next's
releases</a>.</em></p>
<blockquote>
<h2>v14.2.26</h2>
<blockquote>
<p>[!NOTE]<br />
This release is backporting bug fixes. It does <strong>not</strong>
include all pending features/changes on canary.</p>
</blockquote>
<h3>Core Changes</h3>
<ul>
<li>Match subrequest handling for edge and node (<a
href="https://redirect.github.com/vercel/next.js/issues/77476">#77476</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/vercel/next.js/commit/10a042cdca294fd1c6852b320954bc6ccc6064e7"><code>10a042c</code></a>
v14.2.26</li>
<li><a
href="https://github.com/vercel/next.js/commit/8a511d6a22d38132c79b8f70ee29713d42225802"><code>8a511d6</code></a>
Match subrequest handling for edge and node (<a
href="https://redirect.github.com/vercel/next.js/issues/77476">#77476</a>)</li>
<li>See full diff in <a
href="https://github.com/vercel/next.js/compare/v14.2.25...v14.2.26">compare
view</a></li>
</ul>
</details>
<br />


Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions
You can disable automated security fix PRs for this repo from the
[Security Alerts page](https://github.com/e2b-dev/E2B/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: never not exploring <50748440+ben-fornefeld@users.noreply.github.com>
2025-04-04 10:18:54 +02:00
github-actions[bot] e8fadf947b [skip ci] Release new versions 2025-04-03 23:12:36 +00:00
Ben Fornefeld 0d2c6d31b3 chore: refresh lockfile 2025-04-01 13:47:15 +02:00
Ben Fornefeld 07a510ba4e revert: accidental pnpm-lock.yaml deletion 2025-04-01 13:44:27 +02:00
Ben Fornefeld f5f5a0b6ad remove all auth / dashboard related parts & update sitemap to not include dashboard 2025-04-01 13:43:49 +02:00
never not exploring d799ae9210 Merge branch 'main' into dependabot/npm_and_yarn/npm_and_yarn-954d90908d 2025-03-27 13:20:38 +01:00
Jiri Sveceny 197d966ad0 Update cli to latest sdk version (#636) 2025-03-24 17:25:51 +01:00
dependabot[bot] 5701eead65 Bump the npm_and_yarn group across 2 directories with 1 update
Bumps the npm_and_yarn group with 1 update in the / directory: [next](https://github.com/vercel/next.js).
Bumps the npm_and_yarn group with 1 update in the /apps/web directory: [next](https://github.com/vercel/next.js).


Updates `next` from 14.2.21 to 14.2.25
- [Release notes](https://github.com/vercel/next.js/releases)
- [Changelog](https://github.com/vercel/next.js/blob/canary/release.js)
- [Commits](https://github.com/vercel/next.js/compare/v14.2.21...v14.2.25)

Updates `next` from 14.2.21 to 14.2.25
- [Release notes](https://github.com/vercel/next.js/releases)
- [Changelog](https://github.com/vercel/next.js/blob/canary/release.js)
- [Commits](https://github.com/vercel/next.js/compare/v14.2.21...v14.2.25)

---
updated-dependencies:
- dependency-name: next
  dependency-type: direct:production
  dependency-group: npm_and_yarn
- dependency-name: next
  dependency-type: direct:production
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-24 15:11:31 +00:00
yusheng chen 1e9502fe0c chore(apps/web): update package.json (#633)
1. move `@types/node` to `devDependencies`
2. move `@types/react-highlight-words` to `devDependencies`
3. remove unused package `swr`
4. remove unused package `unique-names-generator`
5. remove unused package `uuid`
2025-03-24 07:58:59 -07:00
github-actions[bot] 8fdb429998 [skip ci] Release new versions 2025-03-24 13:33:20 +00:00
github-actions[bot] 5d8b719b21 [skip ci] Release new versions 2025-03-24 11:45:11 +00:00
github-actions[bot] b6b0ac6f97 [skip ci] Release new versions 2025-03-21 15:02:41 +00:00
github-actions[bot] b402327b6d [skip ci] Release new versions 2025-03-20 09:56:31 +00:00
0div c04be45843 update pnpm loockfile 2025-03-13 11:27:24 -07:00