-
Notifications
You must be signed in to change notification settings - Fork 18
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
Test and lint examples #117
Conversation
9405bd3
to
cee84e5
Compare
I have traced it to this commit: f19009e Some dependency here broke it, likely wasmtime, but I am not sure. |
@benbrandt thanks for investigating and narrowing down the regression. I'll take a look. |
I'm trying incrementing the wasi adapter version as well to minimize the change |
I think this might be due to confusion related to WASI 0.2.0 vs. 0.2.1 imports which will require updates to the |
This should fix it: #120 |
Awesome. I had a feeling it might have to do with wasi 0.2.x since wasmtime 25 introduced the next version. Thanks! I'll rebase after you merge and see if I can push the tests further |
cee84e5
to
70fd0c0
Compare
@dicej it seems that everything is working on main, but not if I update the adapter file as I am doing here... I'll try upgrading each version of the adapter file to see which one causes the break. but at least main is working again, thanks for the fix |
bbdbe9f
to
87d3c19
Compare
@dicej Ok I added some basic smoke tests of what is in the readmes. I am not always confident in my bash skills, so if you see anything obvious where this wouldn't catch errors, let me know. For example, I wasn't sure how best to handle the http proxy or tcp examples, so I am just making sure they build for now. |
87d3c19
to
ed3e653
Compare
Also attempted to address #37 I made some changes to see if we could pass "strict" mode if possible so we hopefully don't get flagged in someone else's mypy config |
{docs}{NOT_IMPLEMENTED} | ||
" | ||
) | ||
} else { | ||
format!( | ||
"{enter} | ||
def __exit__(self, *args): | ||
def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the mypy docs, this should be the type signature
@@ -1403,21 +1403,21 @@ class {camel}(Flag): | |||
let docs = | |||
format!(r#""""{newline}{indent}{doc}{newline}{indent}"""{newline}{indent}"#); | |||
let enter = r#" | |||
def __enter__(self): | |||
def __enter__(self) -> Self: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this only works as of 3.11, but should be fine for the component
@@ -1348,14 +1348,14 @@ class {camel}(Flag): | |||
if stub_runtime_calls { | |||
format!( | |||
" | |||
def {snake}({params}): | |||
def {snake}({params}){return_type}: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seemed these were already generated but not added
OutgoingResponse, | ||
Fields, | ||
OutgoingBody, | ||
OutgoingRequest, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems my autoformatting got me here.. I can revert these changes if you like
Thanks for doing this, @benbrandt. I haven't had time yet to do more than skim it, but will review it properly tomorrow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM; thanks! Just one optional suggestion about checking the output in test_examples.sh
(see comment below).
|
||
# HTTP | ||
# Just compiling for now | ||
(cd examples/http \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could potentially use curl
and nc
in background jobs to test the HTTP and TCP examples, respectively. Or else add a test crate written in Rust that exercises them. Not necessary for this PR, though -- just something we could follow up with later.
cargo build --release | ||
|
||
# CLI | ||
(cd examples/cli \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we could send the output of wasmtime run
to a file and then run diff
to compare that with another file containing the expected output. Likewise for the matrix-math
and sandbox
examples.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding this, I wonder if it would be worth doing a Rust crate for this to make it easier to compare the output as well. I don't think I'll get to it today, but I think it could work nicely to solve both problems and shouldn't be too hard to write.
I'm not sure why I didn't default to this in the first place ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM. If you don't have time for it now, we could go ahead and merge this as-is and add the Rust crate as a follow-up PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Realistically, I might not get to this until the weekend, so I'd say it is up to you. If I'm lucky I'll get it done tomorrow, but we'll see
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll go ahead and merge this. No hurry on the Rust crate; this is already a big improvement.
Hi @dicej I attempted to start testing the examples and have run into some issues. With the current codebase, if I run the code in the readme, I get this error:
Since the adapter used for wasi is from Wasmtime 17, I thought that might be the issue, so I am now using the one from the crate
wasi-preview1-component-adapter-provider
to make sure we were using the latest one (and it makes some things a little simpler anyway)However, now it seems that the component can't find the files being added for initialization...
Any ideas? I'm a little worried I broke componentize-py with dependency updates for anyone wanting to target wasi worlds... (we are using a custom world at work)
But I guess that is the point of adding these tests
addresses #15