Skip to content

fix: bring documentation and tutorials up to date with latest tooling #106

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

Merged

Conversation

kate-goldenring
Copy link
Collaborator

A lot of the language guides were out of date. This updates:

  • The example host tutorial to use latest wasmtime
  • removes unnecessary component model flag for wasmtime
  • removes two files that were stranded a while ago (under /implementations ) when they were moved to runtimes
  • calls out componentize-py and wasmtime-py compatibility to avoid this issue Python tooling docs fail with NotImplmentedError #84

I ran through everything and got it working. Ideally we can get this in and iterate if there is a lot of syntactical feedback

Copy link
Collaborator

@itowlson itowlson left a comment

Choose a reason for hiding this comment

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

This is great - it is so good to finally see the tooling starting to smooth out its rough edges. And I love how you've made the flow through the different tutorials more consistent.

My comments are mostly nits except for the one on the printout of the generated Python bindings. I bounced off that pretty hard I'm afraid. But the rest is great.

See [`componentize-py`'s examples](https://github.com/bytecodealliance/componentize-py/tree/main/examples) to try out build HTTP, CLI, and TCP components from Python applications.


### Building a Component that exports an interface
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: capitalisation in this title is a bit random (as, admittedly, it was in the previous iteration).

(Longer term we should pick either Sentence case or Title Case and align all our headings around it. But that's definitely out of scope for this PR!)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah maybe we add a style guide

# app.py
import example

class Add(example.Example):
Copy link
Collaborator

Choose a reason for hiding this comment

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

The explanatory paragraph said "we now implement a class for the add interface rarher than the example world, but this still inherits from example.Example. It would be good to clarify what makes this implement that specific interface (of all the ones in the example world). Is it the class name?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes class name changes

# Get an add component that does not import the WASI CLI world
$ wget https://github.com/bytecodealliance/component-docs/raw/main/component-model/examples/example-host/add.wasm
# Validate the component against the checksum
$ echo "7a64aa30ac7d91b03448001dcdc23760a80c58ecaf220bc70998d49b88820440 add.wasm" | sha256sum --check
Copy link
Collaborator

Choose a reason for hiding this comment

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

This feels like it could easy slip out of sync if we ever rebuild add.wasm.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Should we remove the checksum since it is a module rather than an executable binary? Or we can add a add-checksum file next to it to make it more obvious

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd probably remove the checksum because I have a childlike faith in the Wasm sandbox. Having a checksum file available for people who want it is probably a decent plan, as long as we can automate maintenance. Is the .wasm file built in CI or do authors build locally and check it in?

Copy link
Collaborator Author

@kate-goldenring kate-goldenring Mar 18, 2024

Choose a reason for hiding this comment

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

authors build locally and check it in

this one. Can can have CI for it in the future.

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 removed the checksum

assert(isinstance(lift_callee0, wasmtime.Func))
self.lift_callee0 = lift_callee0
def add(self, caller: wasmtime.Store, x: int, y: int) -> int:
ret = self.lift_callee0(caller, _clamp(x, -2147483648, 2147483647), _clamp(y, -2147483648, 2147483647))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Yikes! Does the user need to understand all this stuff?! Could we elide it, or move it to an "internals" section? If not, can we clarify to readers what they should be looking at?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is all generated code that i wanted to show them in the docs. Normally in the docs, we have not shown the bindings that are generated -- so I will remove this section

@kate-goldenring kate-goldenring force-pushed the update-language-guides branch from afabf3b to 987e170 Compare March 18, 2024 16:13
Signed-off-by: Kate Goldenring <kate.goldenring@fermyon.com>
@kate-goldenring kate-goldenring force-pushed the update-language-guides branch from 987e170 to a4fbcbd Compare March 18, 2024 19:57
Copy link
Collaborator

@itowlson itowlson left a comment

Choose a reason for hiding this comment

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

LGTM but I would like get confirmation that https://github.com/bytecodealliance/component-docs/pull/106/files#r1527609090 is a non-issue please. Otherwise all good! Thanks!

@kate-goldenring kate-goldenring merged commit 91ba47f into bytecodealliance:main Mar 18, 2024
@kate-goldenring kate-goldenring deleted the update-language-guides branch March 18, 2024 22: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.

2 participants