Skip to content

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

Merged
kate-goldenring merged 1 commit into
bytecodealliance:mainfrom
kate-goldenring:update-language-guides
Mar 18, 2024
Merged

kate-goldenring merged 1 commit into
bytecodealliance:mainfrom
kate-goldenring:update-language-guides

Conversation

@kate-goldenring

Copy link
Copy Markdown
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

@itowlson itowlson left a comment

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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?

@kate-goldenring kate-goldenring Mar 18, 2024 •

Copy link
Copy Markdown
Collaborator Author

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@kate-goldenring
kate-goldenring force-pushed the update-language-guides branch from 987e170 to a4fbcbd Compare March 18, 2024 19:57

@itowlson itowlson left a comment

Copy link
Copy Markdown
Collaborator

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