axio-tools-docker 0.11.1__tar.gz → 0.11.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: axio-tools-docker
3
- Version: 0.11.1
3
+ Version: 0.11.3
4
4
  Summary: Docker sandbox tools for Axio
5
5
  Project-URL: Documentation, https://docs.axio-agent.com
6
6
  Project-URL: Homepage, https://github.com/mosquito/axio-agent
@@ -59,6 +59,7 @@ from axio.context import MemoryContextStore
59
59
  from axio.testing import StubTransport, make_text_response
60
60
  from axio_tools_docker import DockerSandbox
61
61
 
62
+
62
63
  async def main() -> None:
63
64
  transport = StubTransport([make_text_response("Done.")])
64
65
  async with DockerSandbox(image="python:3.12-alpine") as sandbox:
@@ -71,6 +72,7 @@ async def main() -> None:
71
72
  result = await agent.run("Print hello from Python.", ctx)
72
73
  print(result)
73
74
 
75
+
74
76
  asyncio.run(main())
75
77
  ```
76
78
 
@@ -96,6 +98,7 @@ Cleanup runs even when the body raises an exception:
96
98
  from axio_tools_docker import DockerSandbox
97
99
  from axio import Agent
98
100
 
101
+
99
102
  async def run(ctx):
100
103
  agent = Agent(
101
104
  system="You are a coding assistant. Use the sandbox tools to run code safely.",
@@ -129,14 +132,17 @@ a new one. Attached containers are never removed on exit - regardless of
129
132
  import asyncio
130
133
  from axio_tools_docker import DockerSandbox
131
134
 
135
+
132
136
  async def first_session() -> None:
133
137
  async with DockerSandbox(image="python:3.12-slim", name="my-sandbox", remove=False) as sb:
134
138
  await sb.exec("pip install requests")
135
139
 
140
+
136
141
  async def second_session() -> None:
137
142
  async with DockerSandbox(name="my-sandbox") as sb:
138
143
  result = await sb.exec("python3 -c 'import requests; print(requests.__version__)'")
139
144
 
145
+
140
146
  asyncio.run(first_session())
141
147
  asyncio.run(second_session())
142
148
  ```
@@ -151,6 +157,7 @@ restarts. Use them to share state between sandbox sessions:
151
157
  import asyncio
152
158
  from axio_tools_docker import DockerSandbox
153
159
 
160
+
154
161
  async def main() -> None:
155
162
  async with DockerSandbox(
156
163
  image="python:3.12-alpine",
@@ -162,11 +169,12 @@ async def main() -> None:
162
169
  async with DockerSandbox(
163
170
  image="python:3.12-alpine",
164
171
  named_volumes={"/data": "my-project-data"},
165
- volumes_remove=True, # delete the volume on exit
172
+ volumes_remove=True, # delete the volume on exit
166
173
  ) as sb:
167
174
  raw = await sb.read_file_bytes("/data/state.json")
168
175
  assert raw.decode() == '{"count": 1}'
169
176
 
177
+
170
178
  asyncio.run(main())
171
179
  ```
172
180
 
@@ -40,6 +40,7 @@ from axio.context import MemoryContextStore
40
40
  from axio.testing import StubTransport, make_text_response
41
41
  from axio_tools_docker import DockerSandbox
42
42
 
43
+
43
44
  async def main() -> None:
44
45
  transport = StubTransport([make_text_response("Done.")])
45
46
  async with DockerSandbox(image="python:3.12-alpine") as sandbox:
@@ -52,6 +53,7 @@ async def main() -> None:
52
53
  result = await agent.run("Print hello from Python.", ctx)
53
54
  print(result)
54
55
 
56
+
55
57
  asyncio.run(main())
56
58
  ```
57
59
 
@@ -77,6 +79,7 @@ Cleanup runs even when the body raises an exception:
77
79
  from axio_tools_docker import DockerSandbox
78
80
  from axio import Agent
79
81
 
82
+
80
83
  async def run(ctx):
81
84
  agent = Agent(
82
85
  system="You are a coding assistant. Use the sandbox tools to run code safely.",
@@ -110,14 +113,17 @@ a new one. Attached containers are never removed on exit - regardless of
110
113
  import asyncio
111
114
  from axio_tools_docker import DockerSandbox
112
115
 
116
+
113
117
  async def first_session() -> None:
114
118
  async with DockerSandbox(image="python:3.12-slim", name="my-sandbox", remove=False) as sb:
115
119
  await sb.exec("pip install requests")
116
120
 
121
+
117
122
  async def second_session() -> None:
118
123
  async with DockerSandbox(name="my-sandbox") as sb:
119
124
  result = await sb.exec("python3 -c 'import requests; print(requests.__version__)'")
120
125
 
126
+
121
127
  asyncio.run(first_session())
122
128
  asyncio.run(second_session())
123
129
  ```
@@ -132,6 +138,7 @@ restarts. Use them to share state between sandbox sessions:
132
138
  import asyncio
133
139
  from axio_tools_docker import DockerSandbox
134
140
 
141
+
135
142
  async def main() -> None:
136
143
  async with DockerSandbox(
137
144
  image="python:3.12-alpine",
@@ -143,11 +150,12 @@ async def main() -> None:
143
150
  async with DockerSandbox(
144
151
  image="python:3.12-alpine",
145
152
  named_volumes={"/data": "my-project-data"},
146
- volumes_remove=True, # delete the volume on exit
153
+ volumes_remove=True, # delete the volume on exit
147
154
  ) as sb:
148
155
  raw = await sb.read_file_bytes("/data/state.json")
149
156
  assert raw.decode() == '{"count": 1}'
150
157
 
158
+
151
159
  asyncio.run(main())
152
160
  ```
153
161
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "axio-tools-docker"
3
- version = "0.11.1"
3
+ version = "0.11.3"
4
4
  description = "Docker sandbox tools for Axio"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"