Skip to content

Commit 891c9b3

Browse files
committed
change code to a working state without pydantic used
1 parent 8d56fbd commit 891c9b3

File tree

4 files changed

+15
-22
lines changed

4 files changed

+15
-22
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
__pycache__
22
some-world
3+
component/output.wasm
4+

app/main.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
from pydantic import BaseModel
1+
import wit_world
22

3-
class Protocol(BaseModel):
4-
text: str
3+
# from pydantic import BaseModel
54

5+
# class Protocol(BaseModel):
6+
# text: str
67

7-
def run(text: str):
8-
return Protocol(text=text).model_dump_json()
8+
9+
class WitWorld(wit_world.WitWorld):
10+
def hello(text: str = "meh"):
11+
return Protocol(text=text).model_dump_json()

component/build.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/bin/bash
22

3-
componentize-py -d main.wit -w string-actor-sync bindings some-world
3+
componentize-py -d main.wit -w hello bindings some-world
44

55
cd /app
6-
componentize-py -w string-actor-sync -d /component/main.wit componentize --stub-wasi main -o /component/output.wasm -p .
7-
# same with: -p /wasi_deps
6+
componentize-py -w hello -d /component/main.wit componentize --stub-wasi main -o /component/output.wasm -p . -p /wasi_deps

component/main.wit

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
1-
package ax:quantum;
1+
package ax:hello;
22

3-
interface incoming-sync {
4-
incoming-request: func(path: string, payload: string) -> result<string, string>;
5-
}
6-
interface outgoing-sync {
7-
outgoing-request: func(path: string, payload: string) -> result<string, string>;
8-
}
9-
world string-actor-sync {
10-
import outgoing-sync;
11-
export incoming-sync;
12-
13-
export init: interface {
14-
init: func();
15-
}
3+
world hello {
4+
export hello: func() -> string;
165
}

0 commit comments

Comments
 (0)