Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix binding generation for lists; add cli test #46

Merged
merged 3 commits into from
Nov 30, 2023
Merged

fix binding generation for lists; add cli test #46

merged 3 commits into from
Nov 30, 2023

Conversation

dicej
Copy link
Collaborator

@dicej dicej commented Nov 30, 2023

This also:

  • moves the examples/http/wit directory to a shared location
  • bumps the version to 0.7.1

This also:
- moves the `examples/http/wit` directory to a shared location
- bumps the version to 0.7.1

Signed-off-by: Joel Dice <joel.dice@fermyon.com>
@dicej dicej mentioned this pull request Nov 30, 2023
This ensures we get the runtime set of CLI args rather than the empty set
present during pre-init.

Signed-off-by: Joel Dice <joel.dice@fermyon.com>
## Running the demo

```
componentize-py -d wit -w matrix-math componentize app -o matrix-math.wasm

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
componentize-py -d wit -w matrix-math componentize app -o matrix-math.wasm
componentize-py -d ../../wit -w matrix-math componentize app -o matrix-math.wasm

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dicej when I run this I get the following error:

$ componentize-py -d ../../wit -w matrix-math componentize app -o matrix-math.wasm
thread '<unnamed>' panicked at src/summary.rs:1183:89:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Traceback (most recent call last):
  File "/opt/homebrew/bin/componentize-py", line 8, in <module>
    sys.exit(script())
             ^^^^^^^^
pyo3_runtime.PanicException: called `Option::unwrap()` on a `None` value

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's part of what this PR fixes. You'll either need to build componentize-py from the branch this PR intends to merge, or wait until it's merged and I've published v0.7.1 to PyPI.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll merge this and do a release once CI finishes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v0.7.1 is live: https://pypi.org/project/componentize-py/
If you install that, plus Wasmtime from the release-15.0.0 branch (e.g. cargo install --locked --git https://github.com/bytecodealliance/wasmtime --branch release-15.0.0 wasmtime-cli), you should be able to run either of the CLI examples.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @dicej, sorry for the delay in testing this out. I was able to test it out again and running the matrix-math example, I get the following error:

$ wasmtime run --wasm component-model matrix-math.wasm '[[1, 2], [4, 5], [6, 7]]' '[[1, 2, 3], [4, 5, 6]]'

Error: failed to run main module `matrix-math.wasm`

Caused by:
    0: import `wasi:random/insecure@0.2.0-rc-2023-11-10` has the wrong type
    1: instance export `get-insecure-random-bytes` has the wrong type
    2: expected func found nothing

I'm pretty sure I updated all my deps to the latest. Any ideas?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does wasmtime --version report? It needs to be 15.0.1 (or later), which includes bytecodealliance/wasmtime#7613, which addresses this issue.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doh you're right! I was still using v15.0.0. I did the cargo install for the new version, but forgot that I had originally installed via bash, so cargo did install the new version but my path was using the bash installed version.

After upgrading this all worked. Thanks for being so patient and for getting this working! =)

…tions

Signed-off-by: Joel Dice <joel.dice@fermyon.com>
@dicej dicej merged commit e1bfe01 into main Nov 30, 2023
1 check passed
@dicej dicej deleted the cli-example branch November 30, 2023 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants