Skip to content

Commit 2e2a2b4

Browse files
committed
prep talk
1 parent 72ac508 commit 2e2a2b4

7 files changed

Lines changed: 180 additions & 68 deletions

File tree

2026-05-pycon/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
Palo Alto, 2026-05-15
44

5-
https://us.pycon.org/2026/schedule/presentation/27/
6-
7-
See [deck-v1.pdf](deck-v1.pdf) for slides.
5+
* [Talk schedule](https://us.pycon.org/2026/schedule/presentation/27/)
6+
* [Deck PDF](deck-v1.pdf)
7+
* Monty repo: [github.com/pydantic/monty](https://github.com/pydantic/monty)
8+
* [Pydantic AI + CodeMoe](https://pydantic.dev/docs/ai/harness/code-mode/)

2026-05-pycon/abstract.md

Lines changed: 0 additions & 15 deletions
This file was deleted.

2026-05-pycon/deck-v1.html

Lines changed: 130 additions & 0 deletions
Large diffs are not rendered by default.

2026-05-pycon/deck-v1.pdf

1.44 MB
Binary file not shown.
Lines changed: 2 additions & 0 deletions
Loading

2026-05-pycon/deck/components/HostLoopCode.tsx

Lines changed: 0 additions & 39 deletions
This file was deleted.

2026-05-pycon/deck/deck.mdx

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import AstExample from "./components/AstExample.tsx";
99
import ResolveExample from "./components/ResolveExample.tsx";
1010
import BytecodeExample from "./components/BytecodeExample.tsx";
1111
import HeapVmDiagram from "./components/HeapVmDiagram.tsx";
12-
import HostLoopCode from "./components/HostLoopCode.tsx";
1312
import hackmontyImg from "./assets/hackmonty.png";
13+
import qrPycon from "./assets/qr-pycon.svg";
1414

1515
<Slide layout="title">
1616

@@ -123,6 +123,14 @@ import hackmontyImg from "./assets/hackmonty.png";
123123

124124
</Slide>
125125

126+
<Slide tab="monty" layout="statement">
127+
128+
# Mini Demo
129+
130+
🤞
131+
132+
</Slide>
133+
126134
<Slide tab="how">
127135

128136
# How Monty works
@@ -134,7 +142,6 @@ import hackmontyImg from "./assets/hackmonty.png";
134142
- Five phases
135143
- First 3 phases can be reused
136144
- The pause/resume protocol is what makes Monty unusual
137-
- Source code → snapshot bytes, fully serializable
138145

139146
</div>
140147

@@ -173,8 +180,8 @@ import hackmontyImg from "./assets/hackmonty.png";
173180
<div>
174181

175182
- Second pass classifies every name: **global**, **local**, **free** (closure), or **`LocalUnassigned`**
176-
- `LocalUnassigned` = name read but never bound → host-provided external function
177183
- String keys become integer `NamespaceId` slot indices
184+
- `LocalUnassigned` = name read but never bound → host-provided external function
178185
- Closure-cell capture decided here so nested functions can reach enclosing locals
179186

180187
</div>
@@ -197,6 +204,12 @@ import hackmontyImg from "./assets/hackmonty.png";
197204
- Effectively a `list[int]` - where each `int` is an opcode and its operands
198205
- This compile step is similar to cpython - why we have `.pyc` files
199206

207+
```python
208+
greeting = 'Hello'
209+
who = get_who(greeting)
210+
f'{greeting} {who}'
211+
```
212+
200213
</div>
201214

202215
<BytecodeExample />
@@ -242,18 +255,36 @@ import hackmontyImg from "./assets/hackmonty.png";
242255

243256
# Step 5 · Pause for the host, resume, repeat
244257

245-
<div style={{ display: 'grid', gridTemplateColumns: '1.3fr 1fr', gap: '2rem', alignItems: 'start' }}>
258+
<div style={{ display: 'grid', gridTemplateColumns: '1fr 1.5fr', gap: '2rem', alignItems: 'start' }}>
246259

247260
<div>
248261

249-
- The VM **never** does I/O directly
250-
- On external work it returns a `RunProgress`: `ExternalCall`, `OsCall`, `MethodCall`, `ResolveFutures`, `NameLookup`, or `Return`
251-
- Each carries a `Snapshot<T>` — heap + VM state, serializable to `postcard` bytes
252-
- Host calls `.resume(result)` to wake the VM up — **anywhere, any time**
262+
- Run the code until we hit an external call
263+
- Then return to the host
264+
- Ask it to call the function
253265

254266
</div>
255267

256-
<HostLoopCode />
268+
<div>
269+
```python
270+
271+
class Monty:
272+
def start(self) -> CallTool | Done: ...
273+
def resume(self, result: ReturnValue | Exception) -> RunProgress: ...
274+
275+
run = Monty(code)
276+
progress = run.start()
277+
278+
while isinstance(progress, CallTool):
279+
# e.g. CallTool("get_who", ("Hello",))
280+
# we could call run.dump() here if we wanted to
281+
result = call_tool(progress.name, progress.args)
282+
progress = run.resume(result)
283+
284+
print(progress)
285+
```
286+
287+
</div>
257288

258289
</div>
259290

@@ -265,7 +296,7 @@ import hackmontyImg from "./assets/hackmonty.png";
265296

266297
- Public bounty at **[hackmonty.com](https://hackmonty.com)**
267298
- Scape the sandbox, read the secret and we'll pay **$5,000**
268-
- Launched 2 weeks ago
299+
- Launched 3 weeks ago
269300
- Vulnerability found via use-after-free bug, and lots of less severe issues
270301
- <div style={{color: 'var(--accent)'}}>Relaunching in a week with double the prize - <b>$10,000</b></div>
271302

@@ -285,7 +316,9 @@ import hackmontyImg from "./assets/hackmonty.png";
285316

286317
# Thank you
287318

288-
Find Monty at **github.com/pydantic/monty**
319+
Find more at [github.com/pydantic/talks/tree/main/2026-05-pycon](https://github.com/pydantic/talks/tree/main/2026-05-pycon#readme)
320+
321+
<img src={qrPycon} alt="QR code linking to the talk repo" style={{ display: 'block', margin: '1rem auto', width: '14rem', height: '14rem', background: 'white', padding: '0.6rem', borderRadius: '0.5rem' }} />
289322

290323
`@samuelcolvin` · `@pydantic`
291324

0 commit comments

Comments
 (0)