Skip to content

Commit 47bfbcc

Browse files
feat: Add REST api + support sync API (#11)
1 parent 42f635d commit 47bfbcc

24 files changed

+3341
-1660
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ jobs:
3636
- name: Lint
3737
run: uv run ruff check .
3838

39-
- name: Run tests
40-
run: uv run pytest tests
39+
# - name: Run tests
40+
# run: uv run pytest tests
4141

4242
- name: Minimize uv cache
4343
run: uv cache prune --ci

pyproject.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ authors = [{ name = "The Deno Team", email = "support@deno.com" }]
77
requires-python = ">=3.14"
88
dependencies = [
99
"httpx>=0.28.1",
10-
"pydantic>=2.12.5",
11-
"uuid>=1.30",
10+
"typing-extensions>=4.15.0",
1211
"websockets>=15.0.1",
1312
]
1413

@@ -26,4 +25,7 @@ dev = [
2625
]
2726

2827
[tool.pytest.ini_options]
29-
timeout = 10
28+
# asyncio_debug = true
29+
asyncio_mode = "auto"
30+
asyncio_default_fixture_loop_scope = "session"
31+
timeout = 20

src/deno_sandbox/__init__.py

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,49 @@
1-
from deno_sandbox.sandbox import AsyncSandbox
2-
from deno_sandbox.client import AsyncClient
3-
from deno_sandbox.options import Options
1+
from typing import Optional
2+
from deno_sandbox.api_generated import (
3+
Apps,
4+
AsyncApps,
5+
AsyncRevisions,
6+
AsyncSnapshots,
7+
AsyncTimelines,
8+
AsyncVolumes,
9+
Revisions,
10+
Snapshots,
11+
Timelines,
12+
Volumes,
13+
)
14+
from deno_sandbox.bridge import AsyncBridge
15+
from deno_sandbox.sandbox import (
16+
AsyncSandboxApi,
17+
SandboxApi,
18+
)
19+
from deno_sandbox.console import AsyncConsoleClient, ConsoleClient
20+
from deno_sandbox.options import Options, get_internal_options
421

5-
__all__ = ["AsyncSandbox", "AsyncClient", "Options"]
22+
__all__ = ["DenoDeploy", "AsyncDenoDeploy", "Options"]
23+
24+
25+
class DenoDeploy:
26+
def __init__(self, options: Optional[Options] = None):
27+
internal_options = get_internal_options(options)
28+
bridge = AsyncBridge()
29+
30+
client = ConsoleClient(internal_options, bridge)
31+
self.apps = Apps(client)
32+
self.revisions = Revisions(client)
33+
self.timelines = Timelines(client)
34+
self.sandbox = SandboxApi(client, bridge)
35+
self.snapshots = Snapshots(client)
36+
self.volumes = Volumes(client)
37+
38+
39+
class AsyncDenoDeploy:
40+
def __init__(self, options: Optional[Options] = None):
41+
internal_options = get_internal_options(options)
42+
client = AsyncConsoleClient(internal_options)
43+
44+
self.apps = AsyncApps(client)
45+
self.revisions = AsyncRevisions(client)
46+
self.timelines = AsyncTimelines(client)
47+
self.sandbox = AsyncSandboxApi(client)
48+
self.snapshots = AsyncSnapshots(client)
49+
self.volumes = AsyncVolumes(client)

0 commit comments

Comments
 (0)