Skip to content

Commit 16bb51d

Browse files
authored
include built-in .py files in bindings output (#176)
Also, bump version to 0.19.1 and update `wasm-tools` dep. Signed-off-by: Joel Dice <joel.dice@fermyon.com>
1 parent 3b628a4 commit 16bb51d

File tree

11 files changed

+76
-80
lines changed

11 files changed

+76
-80
lines changed

Cargo.lock

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

Cargo.toml

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

@@ -15,11 +15,11 @@ tar = "0.4.42"
1515
tempfile = "3.13.0"
1616
zstd = "0.13.2"
1717
# TODO: switch to wasm-tools release once https://github.com/bytecodealliance/wasm-tools/pull/2367 has been merged and released
18-
wasm-encoder = { git = "https://github.com/dicej/wasm-tools", rev = "b072b0ca" }
19-
wit-dylib = { git = "https://github.com/dicej/wasm-tools", rev = "b072b0ca" }
20-
wit-parser = { git = "https://github.com/dicej/wasm-tools", rev = "b072b0ca" }
21-
wit-component = { git = "https://github.com/dicej/wasm-tools", rev = "b072b0ca" }
22-
wasmparser = { git = "https://github.com/dicej/wasm-tools", rev = "b072b0ca" }
18+
wasm-encoder = { git = "https://github.com/bytecodealliance/wasm-tools", rev = "fac9fb50", features = ["wasmparser"] }
19+
wit-dylib = { git = "https://github.com/bytecodealliance/wasm-tools", rev = "fac9fb50" }
20+
wit-parser = { git = "https://github.com/bytecodealliance/wasm-tools", rev = "fac9fb50" }
21+
wit-component = { git = "https://github.com/bytecodealliance/wasm-tools", rev = "fac9fb50" }
22+
wasmparser = { git = "https://github.com/bytecodealliance/wasm-tools", rev = "fac9fb50" }
2323
indexmap = "2.6.0"
2424
bincode = "1.3.3"
2525
heck = "0.5.0"

examples/cli/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ run a Python-based component targetting the [wasi-cli] `command` world.
1010
## Prerequisites
1111

1212
* `Wasmtime` 38.0.0 or later
13-
* `componentize-py` 0.19.0
13+
* `componentize-py` 0.19.1
1414

1515
Below, we use [Rust](https://rustup.rs/)'s `cargo` to install `Wasmtime`. If
1616
you don't have `cargo`, you can download and install from
1717
https://github.com/bytecodealliance/wasmtime/releases/tag/v38.0.0.
1818

1919
```
2020
cargo install --version 38.0.0 wasmtime-cli
21-
pip install componentize-py==0.19.0
21+
pip install componentize-py==0.19.1
2222
```
2323

2424
## Running the demo

examples/http-p3/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ run a Python-based component targetting version `0.3.0-rc-2025-09-16` of the
1111
## Prerequisites
1212

1313
* `Wasmtime` 38.0.0 or later
14-
* `componentize-py` 0.19.0
14+
* `componentize-py` 0.19.1
1515

1616
Below, we use [Rust](https://rustup.rs/)'s `cargo` to install `Wasmtime`. If
1717
you don't have `cargo`, you can download and install from
1818
https://github.com/bytecodealliance/wasmtime/releases/tag/v38.0.0.
1919

2020
```
2121
cargo install --version 38.0.0 wasmtime-cli
22-
pip install componentize-py==0.19.0
22+
pip install componentize-py==0.19.1
2323
```
2424

2525
## Running the demo

examples/http/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ run a Python-based component targetting the [wasi-http] `proxy` world.
1010
## Prerequisites
1111

1212
* `Wasmtime` 38.0.0 or later
13-
* `componentize-py` 0.19.0
13+
* `componentize-py` 0.19.1
1414

1515
Below, we use [Rust](https://rustup.rs/)'s `cargo` to install `Wasmtime`. If
1616
you don't have `cargo`, you can download and install from
1717
https://github.com/bytecodealliance/wasmtime/releases/tag/v38.0.0.
1818

1919
```
2020
cargo install --version 38.0.0 wasmtime-cli
21-
pip install componentize-py==0.19.0
21+
pip install componentize-py==0.19.1
2222
```
2323

2424
## Running the demo

examples/matrix-math/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ within a guest component.
1111
## Prerequisites
1212

1313
* `wasmtime` 38.0.0 or later
14-
* `componentize-py` 0.19.0
14+
* `componentize-py` 0.19.1
1515
* `NumPy`, built for WASI
1616

1717
Note that we use an unofficial build of NumPy since the upstream project does
@@ -23,7 +23,7 @@ https://github.com/bytecodealliance/wasmtime/releases/tag/v38.0.0.
2323

2424
```
2525
cargo install --version 38.0.0 wasmtime-cli
26-
pip install componentize-py==0.19.0
26+
pip install componentize-py==0.19.1
2727
curl -OL https://github.com/dicej/wasi-wheels/releases/download/v0.0.2/numpy-wasi.tar.gz
2828
tar xf numpy-wasi.tar.gz
2929
```

examples/sandbox/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ sandboxed Python code snippets from within a Python app.
88
## Prerequisites
99

1010
* `wasmtime-py` 38.0.0 or later
11-
* `componentize-py` 0.19.0
11+
* `componentize-py` 0.19.1
1212

1313
```
14-
pip install componentize-py==0.19.0 wasmtime==38.0.0
14+
pip install componentize-py==0.19.1 wasmtime==38.0.0
1515
```
1616

1717
## Running the demo

examples/tcp/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ making an outbound TCP request using `wasi-sockets`.
1111
## Prerequisites
1212

1313
* `Wasmtime` 38.0.0 or later
14-
* `componentize-py` 0.19.0
14+
* `componentize-py` 0.19.1
1515

1616
Below, we use [Rust](https://rustup.rs/)'s `cargo` to install `Wasmtime`. If
1717
you don't have `cargo`, you can download and install from
1818
https://github.com/bytecodealliance/wasmtime/releases/tag/v38.0.0.
1919

2020
```
2121
cargo install --version 38.0.0 wasmtime-cli
22-
pip install componentize-py==0.19.0
22+
pip install componentize-py==0.19.1
2323
```
2424

2525
## Running the demo

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ features = ["pyo3/extension-module"]
77

88
[project]
99
name = "componentize-py"
10-
version = "0.19.0"
10+
version = "0.19.1"
1111
description = "Tool to package Python applications as WebAssembly components"
1212
readme = "README.md"
1313
license = { file = "LICENSE" }

src/lib.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@ use {
1212
std::{
1313
borrow::Cow,
1414
collections::HashMap,
15-
fs, iter,
15+
fs,
16+
io::Cursor,
17+
iter,
1618
ops::Deref,
1719
path::{Path, PathBuf},
1820
str,
1921
},
2022
summary::{Escape, Locations, Summary},
23+
tar::Archive,
2124
wasm_encoder::{CustomSection, Section as _},
2225
wasmtime::{
2326
Config, Engine, Store,
@@ -33,6 +36,7 @@ use {
3336
CloneMaps, Package, PackageName, Resolve, Stability, TypeDefKind, UnresolvedPackageGroup,
3437
World, WorldId, WorldItem, WorldKey,
3538
},
39+
zstd::Decoder,
3640
};
3741

3842
pub mod command;
@@ -219,6 +223,13 @@ pub fn generate_bindings(
219223
true,
220224
)?;
221225

226+
Archive::new(Decoder::new(Cursor::new(include_bytes!(concat!(
227+
env!("OUT_DIR"),
228+
"/bundled.tar.zst"
229+
))))?)
230+
.unpack(output_dir)
231+
.unwrap();
232+
222233
Ok(())
223234
}
224235

0 commit comments

Comments
 (0)