2023-08-14 14:54:45 +02:00
|
|
|
[tool.poetry]
|
|
|
|
|
name = "e2b"
|
2026-04-02 19:20:43 +00:00
|
|
|
version = "2.20.0"
|
2023-08-14 14:54:45 +02:00
|
|
|
description = "E2B SDK that give agents cloud environments"
|
|
|
|
|
authors = ["e2b <hello@e2b.dev>"]
|
|
|
|
|
license = "MIT"
|
|
|
|
|
readme = "README.md"
|
|
|
|
|
homepage = "https://e2b.dev/"
|
|
|
|
|
repository = "https://github.com/e2b-dev/e2b/tree/main/packages/python-sdk"
|
2024-07-08 18:33:18 -07:00
|
|
|
packages = [{ include = "e2b" }, { include = "e2b_connect" }]
|
2023-08-14 14:54:45 +02:00
|
|
|
|
|
|
|
|
[tool.poetry.dependencies]
|
2026-01-26 03:40:19 -08:00
|
|
|
python = "^3.10"
|
2023-08-14 14:54:45 +02:00
|
|
|
python-dateutil = ">=2.8.2"
|
Expand folder with double star pattern for recursive hash computation (#994)
Currently, when you provide a simple folder pattern like `folder/` to
copy() it will not check folders contents for changes (only the folder
metadata itself) which leads to stale caches.
This fix appends ** pattern when no pattern is specified for recursive
hash computation.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Ensure folder COPY patterns hash contents recursively to fix cache
invalidation, adding a shared file-gathering helper, tests, and a Python
glob dependency.
>
> - **Template hashing (JS + Python SDKs)**:
> - Add `getAllFilesForFilesHash`
(`packages/js-sdk/src/template/utils.ts`) and
`get_all_files_for_files_hash`
(`packages/python-sdk/e2b/template/utils.py`) to collect directories and
nested files using glob patterns and ignores.
> - Update `calculateFilesHash`/`calculate_files_hash` to use the new
helpers, hashing recursive paths, metadata, and file contents; handle
symlinks consistently.
> - **Tests**:
> - Add comprehensive tests for recursive matching, ignore patterns,
sorting, empty dirs, symlinks in
`packages/js-sdk/tests/.../getAllFilesForFilesHash.test.ts` and Python
async/sync tests under
`packages/python-sdk/tests/.../test_get_all_files_for_files_hash.py`.
> - **Dependencies**:
> - Add `wcmatch` in `packages/python-sdk/pyproject.toml` for advanced
globbing.
> - **Release**:
> - Patch bump via `.changeset/green-mice-watch.md`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
d495427d86ad4e4d5a280567baa63df40a3271fb. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Jakub Dobry <jakub.dobry8@gmail.com>
2025-11-03 16:34:17 +01:00
|
|
|
wcmatch = "^10.1"
|
2025-08-06 03:27:00 -07:00
|
|
|
protobuf = ">=4.21.0"
|
2024-11-03 15:48:28 -08:00
|
|
|
httpcore = "^1.0.5"
|
2024-12-05 20:30:39 -08:00
|
|
|
httpx = ">=0.27.0, <1.0.0"
|
2024-11-01 09:51:18 +00:00
|
|
|
attrs = ">=23.2.0"
|
|
|
|
|
packaging = ">=24.1"
|
2024-11-23 21:58:59 -08:00
|
|
|
typing-extensions = ">=4.1.0"
|
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
|
|
|
dockerfile-parse = "^2.0.1"
|
2025-10-09 14:44:03 +02:00
|
|
|
rich = ">=14.0.0"
|
2023-08-14 14:54:45 +02:00
|
|
|
|
|
|
|
|
[tool.poetry.group.dev.dependencies]
|
2023-08-25 14:19:28 +02:00
|
|
|
pytest = "^7.4.0"
|
|
|
|
|
pytest-xdist = "^3.3.1"
|
2023-09-26 11:02:26 +02:00
|
|
|
python-dotenv = "^1.0.0"
|
2023-10-16 17:08:33 -07:00
|
|
|
pytest-dotenv = "^0.5.2"
|
2024-07-09 00:20:46 -07:00
|
|
|
pytest-asyncio = "^0.23.7"
|
2024-09-20 15:04:57 +02:00
|
|
|
pydoc-markdown = "^4.8.2"
|
2025-10-09 01:37:32 -07:00
|
|
|
datamodel-code-generator = "^0.34.0"
|
2025-06-05 14:52:48 +02:00
|
|
|
ruff = "^0.11.12"
|
2025-11-13 17:58:30 -08:00
|
|
|
pytest-timeout = "^2.4.0"
|
Fix Python SDK type issues with ty type checker (#1122)
## Summary
- Resolved 43 type diagnostics reported by ty (Astral's Python type
checker)
- Fixed Self type issues on class singletons
- Added explicit type annotations for shadowed attributes
- Replaced None with UNSET for auto-generated API parameters
- Fixed method signature alignment for protocol matching
- Added targeted type: ignore suppressions for pattern-based limitations
All checks pass: ty check, ruff format, ruff check.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Mostly typing/CI changes, but some adjustments affect sandbox
connect/pause overload dispatch and API response/parameter handling
(`UNSET` vs `None`), which could alter edge-case runtime behavior.
>
> **Overview**
> Fixes Python SDK static typing issues for Astral’s `ty` checker and
wires typechecking into CI.
>
> Adds a new `Typecheck` GitHub Action plus workspace `typecheck`
scripts (TS packages via `tsc`, Python SDK via `make typecheck` running
`ty`), and publishes a patch changeset for `@e2b/python-sdk`.
>
> Across the Python SDK, adjusts type annotations and overloads (e.g.,
`Self`/singleton typing, `connect` overloads, optional
`user`/token/domain handling), tightens API model parsing with
`cast`/`Optional` checks and `UNSET` usage, and adds a few targeted `ty`
ignore comments in tests/protocols to silence checker limitations.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
f66402847c40cee7e44e1aaa7caa97e271ba9978. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2026-02-12 17:23:39 +01:00
|
|
|
ty = "^0.0.15"
|
2023-08-14 14:54:45 +02:00
|
|
|
|
|
|
|
|
[build-system]
|
|
|
|
|
requires = ["poetry-core"]
|
|
|
|
|
build-backend = "poetry.core.masonry.api"
|
|
|
|
|
|
|
|
|
|
[tool.poetry.urls]
|
|
|
|
|
"Bug Tracker" = "https://github.com/e2b-dev/e2b/issues"
|
2025-07-29 12:39:42 +02:00
|
|
|
|
Fix Python SDK type issues with ty type checker (#1122)
## Summary
- Resolved 43 type diagnostics reported by ty (Astral's Python type
checker)
- Fixed Self type issues on class singletons
- Added explicit type annotations for shadowed attributes
- Replaced None with UNSET for auto-generated API parameters
- Fixed method signature alignment for protocol matching
- Added targeted type: ignore suppressions for pattern-based limitations
All checks pass: ty check, ruff format, ruff check.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Mostly typing/CI changes, but some adjustments affect sandbox
connect/pause overload dispatch and API response/parameter handling
(`UNSET` vs `None`), which could alter edge-case runtime behavior.
>
> **Overview**
> Fixes Python SDK static typing issues for Astral’s `ty` checker and
wires typechecking into CI.
>
> Adds a new `Typecheck` GitHub Action plus workspace `typecheck`
scripts (TS packages via `tsc`, Python SDK via `make typecheck` running
`ty`), and publishes a patch changeset for `@e2b/python-sdk`.
>
> Across the Python SDK, adjusts type annotations and overloads (e.g.,
`Self`/singleton typing, `connect` overloads, optional
`user`/token/domain handling), tightens API model parsing with
`cast`/`Optional` checks and `UNSET` usage, and adds a few targeted `ty`
ignore comments in tests/protocols to silence checker limitations.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
f66402847c40cee7e44e1aaa7caa97e271ba9978. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2026-02-12 17:23:39 +01:00
|
|
|
[tool.basedpyright]
|
|
|
|
|
reportInconsistentOverload = false
|
|
|
|
|
|
|
|
|
|
[tool.ty.rules]
|
|
|
|
|
invalid-overload = "ignore"
|
|
|
|
|
no-matching-overload = "ignore"
|
|
|
|
|
|
|
|
|
|
[[tool.ty.overrides]]
|
|
|
|
|
include = ["e2b/api/client/models/**"]
|
|
|
|
|
rules = { invalid-argument-type = "ignore" }
|
|
|
|
|
|
|
|
|
|
[[tool.ty.overrides]]
|
|
|
|
|
include = ["e2b/envd/**/*.pyi"]
|
|
|
|
|
rules = { conflicting-metaclass = "ignore", unresolved-attribute = "ignore" }
|
|
|
|
|
|
2026-03-26 01:37:46 +01:00
|
|
|
[[tool.ty.overrides]]
|
|
|
|
|
include = ["e2b/volume/**"]
|
|
|
|
|
rules = { unresolved-attribute = "ignore" }
|
|
|
|
|
|
2025-07-29 12:39:42 +02:00
|
|
|
[tool.ruff]
|
|
|
|
|
exclude = [
|
|
|
|
|
"e2b/envd/filesystem/filesystem_pb2.py"
|
2025-10-09 14:44:03 +02:00
|
|
|
]
|