Skip to content

Commit 65e7697

Browse files
peterhuenedicej
andauthored
Update dependencies to latest. (#44)
* Update dependencies to latest. This commit updates dependencies to latest. It also updates the WASI adapter to be compatible with Wasmtime 15. * Fix linting error. * Add missing semicolons to WITs. * Add more missing semicolons. * Fix to tests for changed resource API. * More fixes to Wasmtime 15 API changes. * More API changes. * More test fixes. * remove obsolete paragraph from README.md Signed-off-by: Joel Dice <joel.dice@fermyon.com> * bump version to 0.7.0; update http example Signed-off-by: Joel Dice <joel.dice@fermyon.com> --------- Signed-off-by: Joel Dice <joel.dice@fermyon.com> Co-authored-by: Joel Dice <joel.dice@fermyon.com>
1 parent e34f133 commit 65e7697

57 files changed

Lines changed: 2359 additions & 2410 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.lock

Lines changed: 612 additions & 723 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "componentize-py"
3-
version = "0.6.0"
3+
version = "0.7.0"
44
edition = "2021"
55
exclude = ["cpython"]
66

@@ -9,43 +9,43 @@ name = "componentize_py"
99
crate-type = ["cdylib", "rlib"]
1010

1111
[dependencies]
12-
anyhow = { version = "1.0.68", features = ["backtrace"] }
13-
clap = { version = "4.1.4", features = ["derive"] }
14-
tar = "0.4.38"
15-
tempfile = "3.5.0"
16-
zstd = "0.11.1"
12+
anyhow = { version = "1.0.75", features = ["backtrace"] }
13+
clap = { version = "4.4.10", features = ["derive"] }
14+
tar = "0.4.40"
15+
tempfile = "3.8.1"
16+
zstd = "0.13.0"
1717
componentize-py-shared = { path = "shared" }
18-
wasmparser = "0.107.0"
19-
wasm-encoder = "0.29.0"
20-
wit-parser = "0.12.2"
21-
wit-component = "0.17.0"
22-
indexmap = "2.0.0"
18+
wasmparser = "0.118.0"
19+
wasm-encoder = "0.38.0"
20+
wit-parser = "0.13.0"
21+
wit-component = "0.18.2"
22+
indexmap = "2.1.0"
2323
bincode = "1.3.3"
2424
heck = "0.4.1"
25-
pyo3 = { version = "0.18.3", features = ["abi3-py37", "extension-module"], optional = true }
26-
wasmtime-wasi = "14.0.3"
27-
wasi-common = "14.0.3"
28-
wasmtime = { version = "14.0.3", features = [ "component-model" ] }
29-
once_cell = "1.17.1"
25+
pyo3 = { version = "0.20.0", features = ["abi3-py37", "extension-module"], optional = true }
26+
wasmtime-wasi = "15.0.0"
27+
wasi-common = "15.0.0"
28+
wasmtime = { version = "15.0.0", features = [ "component-model" ] }
29+
once_cell = "1.18.0"
3030
component-init = { git = "https://github.com/dicej/component-init" }
31-
async-trait = "0.1.68"
32-
futures = "0.3.28"
33-
tokio = { version = "1.27.0", features = ["macros", "rt", "rt-multi-thread", "fs"] }
34-
bytes = "1.4.0"
31+
async-trait = "0.1.74"
32+
futures = "0.3.29"
33+
tokio = { version = "1.34.0", features = ["macros", "rt", "rt-multi-thread", "fs"] }
34+
bytes = "1.5.0"
3535
pretty_env_logger = "0.5.0"
3636
cap-std = "2.0.0"
3737
im-rc = "15.1.0"
3838

3939
[dev-dependencies]
40-
async-trait = "0.1.68"
41-
once_cell = "1.17.1"
42-
proptest = "1.1.0"
40+
async-trait = "0.1.74"
41+
once_cell = "1.18.0"
42+
proptest = "1.4.0"
4343
hex = "0.4.3"
4444

4545
[build-dependencies]
46-
anyhow = "1.0.68"
47-
tar = "0.4.38"
48-
zstd = "0.11.1"
46+
anyhow = "1.0.75"
47+
tar = "0.4.40"
48+
zstd = "0.13.0"
4949
test-generator = { path = "test-generator" }
5050

5151
[workspace]

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,6 @@ For an example of running a sandboxed Python guest within a Python host, see
6969

7070
## Known Limitations
7171

72-
This project does not yet support [interface
73-
versions](https://github.com/WebAssembly/component-model/blob/main/design/mvp/WIT.md#package-declaration),
74-
but it's coming soon.
75-
7672
Currently, the application can only import dependencies during build time, which
7773
means any imports used at runtime must be resolved at the top level of the
7874
application module. For example, if `x` is a module with a submodule named `y`
94.7 KB
Binary file not shown.

adapters/README.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
11
The subdirectory of this directory contains a build of the WASI Preview 1
2-
component adapter. It was built from commit `e8766e49` of
3-
https://github.com/dicej/wasmtime using the
4-
`ci/build-wasi-preview1-component-adapter.sh` script.
5-
6-
TODO: Switch back to upstream once
7-
https://github.com/bytecodealliance/wasmtime/pull/7444 has been merged and
8-
released.
2+
component adapter. It was built from commit `6f0da84` of
3+
https://github.com/bytecodealliance/wasmtime.
-107 KB
Binary file not shown.

build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ fn package_all_the_things(out_dir: &Path) -> Result<()> {
135135
let path = out_dir.join("wasm32-wasi/release/libcomponentize_py_runtime.a");
136136

137137
if path.exists() {
138-
let clang = wasi_sdk.join(&format!("bin/{CLANG_EXECUTABLE}"));
138+
let clang = wasi_sdk.join(format!("bin/{CLANG_EXECUTABLE}"));
139139
if clang.exists() {
140140
let name = "libcomponentize_py_runtime.so";
141141

@@ -209,7 +209,7 @@ fn package_all_the_things(out_dir: &Path) -> Result<()> {
209209
}
210210

211211
compress(
212-
&repo_dir.join("adapters/e8766e49"),
212+
&repo_dir.join("adapters/6f0da84"),
213213
"wasi_snapshot_preview1.reactor.wasm",
214214
out_dir,
215215
false,

bundled/poll_loop.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Defines a custom `asyncio` event loop backed by `wasi:io/poll#poll-list`.
1+
"""Defines a custom `asyncio` event loop backed by `wasi:io/poll#poll`.
22
33
This also includes helper classes and functions for working with `wasi:http`.
44
@@ -108,7 +108,7 @@ def close(self):
108108
self.body = None
109109

110110
class PollLoop(asyncio.AbstractEventLoop):
111-
"""Custom `asyncio` event loop backed by `wasi:io/poll#poll-list`."""
111+
"""Custom `asyncio` event loop backed by `wasi:io/poll#poll`."""
112112

113113
def __init__(self):
114114
self.wakers = []
@@ -135,7 +135,7 @@ def run_until_complete(self, future):
135135

136136
new_wakers = []
137137
ready = [False] * len(pollables)
138-
for index in poll.poll_list(pollables):
138+
for index in poll.poll(pollables):
139139
ready[index] = True
140140

141141
for (ready, pollable), waker in zip(zip(ready, pollables), wakers):

examples/http/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ which may differ from later revisions.
1414
## Prerequisites
1515

1616
* `Wasmtime` 14.0.3 (later versions may use a different, incompatible `wasi-http` snapshot)
17-
* `componentize-py` 0.6.0
17+
* `componentize-py` 0.7.0
1818

1919
Below, we use [Rust](https://rustup.rs/)'s `cargo` to install `Wasmtime`. If
2020
you don't have `cargo`, you can download and install from
21-
https://github.com/bytecodealliance/wasmtime/releases/tag/v14.0.3.
21+
https://github.com/bytecodealliance/wasmtime/releases/tag/v15.0.0.
2222

2323
```
24-
cargo install --version 14.0.3 wasmtime-cli
24+
cargo install --version 15.0.0 wasmtime-cli
2525
pip install componentize-py
2626
```
2727

@@ -30,7 +30,7 @@ pip install componentize-py
3030
First, build the app and run it:
3131

3232
```
33-
componentize-py -d wit -w proxy componentize app -o http.wasm
33+
componentize-py -d wit -w wasi:http/proxy@0.2.0-rc-2023-11-10 componentize app -o http.wasm
3434
wasmtime serve http.wasm
3535
```
3636

examples/http/app.py

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ async def handle_async(request: IncomingRequest, response_out: ResponseOutparam)
4848

4949
urls = map(lambda pair: str(pair[1], "utf-8"), filter(lambda pair: pair[0] == "url", headers))
5050

51-
response = OutgoingResponse(200, Fields([("content-type", b"text/plain")]))
51+
response = OutgoingResponse(Fields.from_list([("content-type", b"text/plain")]))
5252

53-
response_body = response.write()
53+
response_body = response.body()
5454

5555
ResponseOutparam.set(response_out, Ok(response))
5656

@@ -64,12 +64,9 @@ async def handle_async(request: IncomingRequest, response_out: ResponseOutparam)
6464
elif isinstance(method, MethodPost) and path == "/echo":
6565
# Echo the request body back to the client without buffering.
6666

67-
response = OutgoingResponse(
68-
200,
69-
Fields(list(filter(lambda pair: pair[0] == "content-type", headers)))
70-
)
67+
response = OutgoingResponse(Fields.from_list(list(filter(lambda pair: pair[0] == "content-type", headers))))
7168

72-
response_body = response.write()
69+
response_body = response.body()
7370

7471
ResponseOutparam.set(response_out, Ok(response))
7572

@@ -84,9 +81,10 @@ async def handle_async(request: IncomingRequest, response_out: ResponseOutparam)
8481

8582
sink.close()
8683
else:
87-
response = OutgoingResponse(400, Fields([]))
84+
response = OutgoingResponse(Fields.from_list([]))
85+
response.set_status_code(400)
8886
ResponseOutparam.set(response_out, Ok(response))
89-
OutgoingBody.finish(response.write(), None)
87+
OutgoingBody.finish(response.body(), None)
9088

9189
async def sha256(url: str) -> Tuple[str, str]:
9290
"""Download the contents of the specified URL, computing the SHA-256
@@ -106,13 +104,10 @@ async def sha256(url: str) -> Tuple[str, str]:
106104
case _:
107105
scheme = SchemeOther(url_parsed.scheme)
108106

109-
request = OutgoingRequest(
110-
MethodGet(),
111-
url_parsed.path,
112-
scheme,
113-
url_parsed.netloc,
114-
Fields([])
115-
)
107+
request = OutgoingRequest(Fields.from_list([]))
108+
request.set_scheme(scheme)
109+
request.set_authority(url_parsed.netloc)
110+
request.set_path_with_query(url_parsed.path)
116111

117112
response = await poll_loop.send(request)
118113
status = response.status()

0 commit comments

Comments
 (0)