Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
5e089b8
Fork v4 docs from v3
itowlson Mar 18, 2026
e93d6f4
Build profiles
itowlson Mar 18, 2026
854fc78
Mostly maintenance but I forgot and did some manifest stuff in this o…
itowlson Mar 19, 2026
60c0fda
More BPs
itowlson Mar 19, 2026
bbff617
Probably don't want folks using async SDK with 3.x
itowlson Mar 19, 2026
dc70154
http_component -> http_service
itowlson Mar 23, 2026
ecb7b26
Instance reuse
itowlson Mar 23, 2026
fc78dcf
Link woe
itowlson Mar 23, 2026
cbc3b0b
Outbound HTTP Rust bodies
itowlson Mar 26, 2026
f5f11ad
HTTP component tweaks
itowlson Mar 26, 2026
9c4eee6
Moar bits
itowlson Mar 26, 2026
7cdb9a1
It's time for your daily thwarting
itowlson Mar 26, 2026
7f52335
Today's commit is brought to you by the letter R
itowlson Mar 26, 2026
0b63ab0
More from the letter R whee
itowlson Mar 26, 2026
9e11fd7
boop
itowlson Mar 26, 2026
338924e
Variables
itowlson Mar 27, 2026
a39c8f9
We don't have bandwidth to get spin test working with P3
itowlson Mar 27, 2026
777026d
Bits
itowlson Mar 27, 2026
c014b3c
tweaks
itowlson Mar 30, 2026
6f615fd
Added Go P3 HTTP example
itowlson Mar 30, 2026
914a3bd
Oh dear, these are Go thingies but it remains a bit partial for now, …
itowlson Mar 31, 2026
bc39709
SQLite
itowlson Mar 31, 2026
d8da759
More database tweaks
itowlson Apr 1, 2026
14a58b7
Link fie
itowlson Apr 1, 2026
12a55d1
WIT spawn sample for Rust
itowlson Apr 1, 2026
d3629f1
Use simpler components for showing app structure
itowlson Apr 1, 2026
a992da3
Async stuff for Rust and Go
itowlson Apr 1, 2026
b9c43ba
Fixes
itowlson Apr 6, 2026
df70d5a
Python async
itowlson Apr 7, 2026
343cbf3
docs(v4): update Python code snippets/links/details
vdice Apr 8, 2026
ac9a62d
Apply suggestions from code review
vdice Apr 9, 2026
8e2bf4c
docs(content/v4): further Python SDK/example amendments
vdice Apr 9, 2026
35340db
docs(content/v4): python-components.md snippets/links updates
vdice Apr 9, 2026
1250ba3
Merge pull request #1 from vdice/spin-4.0-py-api-and-code-updates
itowlson Apr 9, 2026
5d631c8
Default to Spin 3.x (in case we want to merge before Spin 4 ships)
itowlson Apr 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .build/check-broken-links.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ if ! blc -rv
--exclude 'https://marketplace.visualstudio.com/items?itemName=BytecodeAlliance.starlingmonkey-debugger' \
--exclude 'http://localhost:16686/' \
--exclude 'http://localhost:5050/explore' \
`## Spin 4 bits not yet published` \
--exclude 'https://github.com/spinframework/spin-docs/blob/main/content/v4' \
--exclude 'https://docs.rs/spin-sdk/latest/spin_sdk' \
http://127.0.0.1:3000/v3/javascript-components \
| tee "${report}"
then
Expand Down
4 changes: 2 additions & 2 deletions content/blog/announcing-spin-3-5.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ One thing you’ll notice the moment you try out the new SDK is that you’re us
<img src="/static/image/blog/announcing-spin-3-5-gh-comment.png" alt="Bytecode Alliance member github comment on wasi-rs contribution">
</figure>

But that’s not where the interoperability story ends. Because of the design of the SDK in conjunction with the async support provided by WASIp3, it is now more seamless to bring your own web frameworks to use in Spin components. See for instance the Axum example [here](https://github.com/spinframework/spin-rust-sdk/tree/main/examples/wasip3-http-axum-router). Historically, this was possible to do but required management of more lower level types. See the Axum example with WASIp2 [here](https://github.com/fermyon/wasi-hyperium/blob/main/examples/axum-server/src/lib.rs) for comparison. We’d love to hear more feedback on this experience through [GitHub issues](https://github.com/spinframework/spin-rust-sdk/issues), on [Slack](https://cloud-native.slack.com/archives/C089NJ9G1V0), or during [project meetings](https://github.com/spinframework/spin#getting-involved-and-contributing).
But that’s not where the interoperability story ends. Because of the design of the SDK in conjunction with the async support provided by WASIp3, it is now more seamless to bring your own web frameworks to use in Spin components. See for instance the Axum example [here](https://github.com/spinframework/spin-rust-sdk/tree/v5.2.0/examples/wasip3-http-axum-router). Historically, this was possible to do but required management of more lower level types. See the Axum example with WASIp2 [here](https://github.com/fermyon/wasi-hyperium/blob/main/examples/axum-server/src/lib.rs) for comparison. We’d love to hear more feedback on this experience through [GitHub issues](https://github.com/spinframework/spin-rust-sdk/issues), on [Slack](https://cloud-native.slack.com/archives/C089NJ9G1V0), or during [project meetings](https://github.com/spinframework/spin#getting-involved-and-contributing).

#### More on Language Support

Expand Down Expand Up @@ -84,7 +84,7 @@ You should now see a `hello-p3` directory containing a basic p3 application usin

### Deep Dive Into Example

The Rust SDK repo provides examples of things you can now do with p3 support. Let’s dive into one of them. With WASIp3 support in Spin, you can make concurrent outbound HTTP requests from within a component. See full example [here](https://github.com/spinframework/spin-rust-sdk/tree/main/examples/wasip3-concurrent-outbound-http-calls).
The Rust SDK repo provides examples of things you can now do with p3 support. Let’s dive into one of them. With WASIp3 support in Spin, you can make concurrent outbound HTTP requests from within a component. See full example [here](https://github.com/spinframework/spin-rust-sdk/tree/v5.2.0/examples/wasip3-concurrent-outbound-http-calls).

The first step of using the SDK is opting into the `wasip3-unstable` feature as is done on the last line of the `Cargo.toml` file above. Also note Rust 1.90 and the `wasm32-wasip2` target are required to build WASIp3 components. (WASIp2 and p3 have the same binary representation, with p3 adding additional features. The `wasm32-wasip2` target causes the Rust compiler to emit the right binary format, with the SDK adding the additional p3 features.)

Expand Down
2 changes: 1 addition & 1 deletion content/v2/http-outbound.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ async fn handle_request(_req: Request) -> anyhow::Result<impl IntoResponse> {
}
```

For an example of receiving the response in a streaming style, [see this example in the Spin repository](https://github.com/spinframework/spin-rust-sdk/blob/main/examples/wasi-http-streaming-outgoing-body/src/lib.rs).
For an example of receiving the response in a streaming style, [see this example in the Spin repository](https://github.com/spinframework/spin-rust-sdk/tree/v5.2.0/examples/wasi-http-streaming-outgoing-body/src/lib.rs).

{{ blockEnd }}

Expand Down
2 changes: 1 addition & 1 deletion content/v2/rust-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ proxies or URL shorteners.

<!-- @searchTerm "async" -->

The Rust SDK [provides a router](https://github.com/spinframework/spin-rust-sdk/tree/main/examples/http-router) that makes it easier to handle routing within a component:
The Rust SDK [provides a router](https://github.com/spinframework/spin-rust-sdk/tree/v5.2.0/examples/http-router) that makes it easier to handle routing within a component:

```rust
use anyhow::Result;
Expand Down
18 changes: 9 additions & 9 deletions content/v3/http-outbound.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,28 @@ The outbound HTTP interface depends on your language.

{{ startTab "Rust"}}

> [**Want to go straight to the reference documentation?** Find it here.](https://docs.rs/spin-sdk/latest/spin_sdk/http/index.html)
> [**Want to go straight to the reference documentation?** Find it here.](https://docs.rs/spin-sdk/5.2.0/spin_sdk/http/index.html)

To send requests, use the [`spin_sdk::http::send`](https://docs.rs/spin-sdk/latest/spin_sdk/http/fn.send.html) function. This takes a request argument and returns a response (or error). It is `async`, so within an async inbound handler you can have multiple outbound `send`s running concurrently.
To send requests, use the [`spin_sdk::http::send`](https://docs.rs/spin-sdk/5.2.0/spin_sdk/http/fn.send.html) function. This takes a request argument and returns a response (or error). It is `async`, so within an async inbound handler you can have multiple outbound `send`s running concurrently.

> Support for streaming request and response bodies is **experimental**. We currently recommend that you stick with the simpler non-streaming interfaces if you don't require streaming.

`send` is quite flexible in its request and response types. The request may be:

* [`http::Request`](https://docs.rs/http/latest/http/request/struct.Request.html) - typically constructed via `http::Request::builder()`
* [`spin_sdk::http::Request`](https://docs.rs/spin-sdk/latest/spin_sdk/http/struct.Request.html) - typically constructed via `spin_sdk::http::Request::get()`, `spin_sdk::http::Request::post()`, or `spin_sdk::http::Request::builder()`
* You can also use the [builder type](https://docs.rs/spin-sdk/latest/spin_sdk/http/struct.RequestBuilder.html) directly - `build` will be called automatically for you
* [`spin_sdk::http::OutgoingRequest`](https://docs.rs/spin-sdk/latest/spin_sdk/http/struct.OutgoingRequest.html) - constructed via `OutgoingRequest::new()`
* [`spin_sdk::http::Request`](https://docs.rs/spin-sdk/5.2.0/spin_sdk/http/struct.Request.html) - typically constructed via `spin_sdk::http::Request::get()`, `spin_sdk::http::Request::post()`, or `spin_sdk::http::Request::builder()`
* You can also use the [builder type](https://docs.rs/spin-sdk/5.2.0/spin_sdk/http/struct.RequestBuilder.html) directly - `build` will be called automatically for you
* [`spin_sdk::http::OutgoingRequest`](https://docs.rs/spin-sdk/5.2.0/spin_sdk/http/struct.OutgoingRequest.html) - constructed via `OutgoingRequest::new()`
* Any type for which you have implemented the `TryInto<spin_sdk::http::OutgoingRequest>` trait

Generally, you should use `OutgoingRequest` when you need to stream the outbound request body; otherwise, the `Request` types are usually simpler.

The response may be:

* [`http::Response`](https://docs.rs/http/latest/http/response/struct.Response.html)
* [`spin_sdk::http::Response`](https://docs.rs/spin-sdk/latest/spin_sdk/http/struct.Response.html)
* [`spin_sdk::http::IncomingResponse`](https://docs.rs/spin-sdk/latest/spin_sdk/http/struct.IncomingResponse.html)
* Any type for which you have implemented the [spin_sdk::http::conversions::TryFromIncomingResponse](https://docs.rs/spin-sdk/latest/spin_sdk/http/conversions/trait.TryFromIncomingResponse.html) trait
* [`spin_sdk::http::Response`](https://docs.rs/spin-sdk/5.2.0/spin_sdk/http/struct.Response.html)
* [`spin_sdk::http::IncomingResponse`](https://docs.rs/spin-sdk/5.2.0/spin_sdk/http/struct.IncomingResponse.html)
* Any type for which you have implemented the [spin_sdk::http::conversions::TryFromIncomingResponse](https://docs.rs/spin-sdk/5.2.0/spin_sdk/http/conversions/trait.TryFromIncomingResponse.html) trait

Generally, you should use `IncomingResponse` when you need to stream the response body; otherwise, the `Response` types are usually simpler.

Expand Down Expand Up @@ -87,7 +87,7 @@ async fn handle_request(_req: Request) -> anyhow::Result<impl IntoResponse> {
}
```

For an example of receiving the response in a streaming style, [see this example in the Spin repository](https://github.com/spinframework/spin-rust-sdk/blob/main/examples/wasi-http-streaming-outgoing-body/src/lib.rs).
For an example of receiving the response in a streaming style, [see this example in the Spin repository](https://github.com/spinframework/spin-rust-sdk/tree/v5.2.0/examples/wasi-http-streaming-outgoing-body/src/lib.rs).

{{ blockEnd }}

Expand Down
20 changes: 10 additions & 10 deletions content/v3/http-trigger.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ The exact signature of the HTTP handler, and how a function is identified to be

{{ startTab "Rust"}}

> [**Want to go straight to the reference documentation?** Find it here.](https://docs.rs/spin-sdk/latest/spin_sdk/http/index.html)
> [**Want to go straight to the reference documentation?** Find it here.](https://docs.rs/spin-sdk/5.2.0/spin_sdk/http/index.html)

In Rust, the handler is identified by the [`#[spin_sdk::http_component]`](https://docs.rs/spin-sdk/latest/spin_sdk/attr.http_component.html) attribute. The handler function can have one of two forms: _request-response_ or _input-output parameter_.
In Rust, the handler is identified by the [`#[spin_sdk::http_component]`](https://docs.rs/spin-sdk/5.2.0/spin_sdk/attr.http_component.html) attribute. The handler function can have one of two forms: _request-response_ or _input-output parameter_.

**Request-Response Handlers**

Expand All @@ -174,15 +174,15 @@ In this form, nothing is sent to the client until the entire response is ready.
You have some flexibility in choosing the types of the request and response. The request may be:

* [`http::Request`](https://docs.rs/http/latest/http/request/struct.Request.html)
* [`spin_sdk::http::Request`](https://docs.rs/spin-sdk/latest/spin_sdk/http/struct.Request.html)
* [`spin_sdk::http::IncomingRequest`](https://docs.rs/spin-sdk/latest/spin_sdk/http/struct.IncomingRequest.html)
* Any type for which you have implemented the [`spin_sdk::http::conversions::TryFromIncomingRequest`](https://docs.rs/spin-sdk/latest/spin_sdk/http/conversions/trait.TryFromIncomingRequest.html) trait
* [`spin_sdk::http::Request`](https://docs.rs/spin-sdk/5.2.0/spin_sdk/http/struct.Request.html)
* [`spin_sdk::http::IncomingRequest`](https://docs.rs/spin-sdk/5.2.0/spin_sdk/http/struct.IncomingRequest.html)
* Any type for which you have implemented the [`spin_sdk::http::conversions::TryFromIncomingRequest`](https://docs.rs/spin-sdk/5.2.0/spin_sdk/http/conversions/trait.TryFromIncomingRequest.html) trait

The response may be:

* [`http::Response`](https://docs.rs/http/latest/http/response/struct.Response.html) - typically constructed via `Response::builder()`
* [`spin_sdk::http::Response`](https://docs.rs/spin-sdk/latest/spin_sdk/http/struct.Response.html) - typically constructed via a [`ResponseBuilder`](https://docs.rs/spin-sdk/latest/spin_sdk/http/struct.ResponseBuilder.html)
* Any type for which you have implemented the [`spin_sdk::http::IntoResponse`](https://docs.rs/spin-sdk/latest/spin_sdk/http/trait.IntoResponse.html) trait
* [`spin_sdk::http::Response`](https://docs.rs/spin-sdk/5.2.0/spin_sdk/http/struct.Response.html) - typically constructed via a [`ResponseBuilder`](https://docs.rs/spin-sdk/5.2.0/spin_sdk/http/struct.ResponseBuilder.html)
* Any type for which you have implemented the [`spin_sdk::http::IntoResponse`](https://docs.rs/spin-sdk/5.2.0/spin_sdk/http/trait.IntoResponse.html) trait
* A `Result` where the success type is one of the above and the error type is `anyhow::Error` or another error type for which you have implemented `spin_sdk::http::IntoResponse` (such as `anyhow::Result<http::Response>`)

For example:
Expand All @@ -208,11 +208,11 @@ To extract data from the request, specify a body type as the generic parameter f

**Input-Output Parameter Handlers**

In this form, the handler function receives the request as an argument of type [`spin_sdk::http::IncomingRequest`](https://docs.rs/spin-sdk/latest/spin_sdk/http/struct.IncomingRequest.html). It also receives an argument of type [`spin_sdk::http::ResponseOutparam`](https://docs.rs/spin-sdk/latest/spin_sdk/http/struct.ResponseOutparam.html), through which is sends the response. The function does not return a value. This form is recommended for streaming responses.
In this form, the handler function receives the request as an argument of type [`spin_sdk::http::IncomingRequest`](https://docs.rs/spin-sdk/5.2.0/spin_sdk/http/struct.IncomingRequest.html). It also receives an argument of type [`spin_sdk::http::ResponseOutparam`](https://docs.rs/spin-sdk/5.2.0/spin_sdk/http/struct.ResponseOutparam.html), through which is sends the response. The function does not return a value. This form is recommended for streaming responses.

To send a response:

1. Create a [`spin_sdk::http::OutgoingResponse`](https://docs.rs/spin-sdk/latest/spin_sdk/http/struct.OutgoingResponse.html).
1. Create a [`spin_sdk::http::OutgoingResponse`](https://docs.rs/spin-sdk/5.2.0/spin_sdk/http/struct.OutgoingResponse.html).
2. Call `take_body()` on the `OutgoingResponse` - this gives you a [`futures::Sink`](https://docs.rs/futures/latest/futures/sink/trait.Sink.html) that you can later use to send data via the response.
3. Call `set` on the `ResponseOutparam`, passing the `OutgoingResponse`.
4. Call `send` on the `Sink` as many times as you like. Each send is carried out as you call it, so you can send the first part of the response without waiting for the whole response to be ready.
Expand Down Expand Up @@ -251,7 +251,7 @@ async fn handle_hello_rust(_req: IncomingRequest, response_out: ResponseOutparam
}
```

For a full Rust SDK reference, see the [Rust Spin SDK documentation](https://docs.rs/spin-sdk/latest/spin_sdk/index.html).
For a full Rust SDK reference, see the [Rust Spin SDK documentation](https://docs.rs/spin-sdk/5.2.0/spin_sdk/index.html).

{{ blockEnd }}

Expand Down
2 changes: 1 addition & 1 deletion content/v3/kv-store-api-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ The exact detail of calling these operations from your application depends on yo

{{ startTab "Rust"}}

> [**Want to go straight to the reference documentation?** Find it here.](https://docs.rs/spin-sdk/latest/spin_sdk/key_value/index.html)
> [**Want to go straight to the reference documentation?** Find it here.](https://docs.rs/spin-sdk/5.2.0/spin_sdk/key_value/index.html)

Key value functions are available in the `spin_sdk::key_value` module. The function names match the operations above. For example:

Expand Down
2 changes: 1 addition & 1 deletion content/v3/language-support-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This page contains information about language support for Spin features:

{{ startTab "Rust"}}

**[📄 Visit the Rust Spin SDK reference documentation](https://docs.rs/spin-sdk/latest/spin_sdk/) to see specific modules, functions, variables and syntax relating to the following Rust features.**
**[📄 Visit the Rust Spin SDK reference documentation](https://docs.rs/spin-sdk/5.2.0/spin_sdk/) to see specific modules, functions, variables and syntax relating to the following Rust features.**

| Feature | SDK Supported? |
|-----|-----|
Expand Down
4 changes: 2 additions & 2 deletions content/v3/mqtt-outbound.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The exact detail of calling these operations from your application depends on yo

{{ startTab "Rust"}}

> [**Want to go straight to the reference documentation?** Find it here.](https://docs.rs/spin-sdk/latest/spin_sdk/mqtt/index.html)
> [**Want to go straight to the reference documentation?** Find it here.](https://docs.rs/spin-sdk/5.2.0/spin_sdk/mqtt/index.html)

MQTT functions are available in the `spin_sdk::mqtt` module.

Expand All @@ -49,7 +49,7 @@ let cat_picture: Vec<u8> = request.body().to_vec();
connection.publish("pets", &cat_picture, spin_sdk::mqtt::Qos::AtLeastOnce)?;
```

For full details of the MQTT API, see the [Spin SDK reference documentation](https://docs.rs/spin-sdk/latest/spin_sdk/mqtt/index.html);
For full details of the MQTT API, see the [Spin SDK reference documentation](https://docs.rs/spin-sdk/5.2.0/spin_sdk/mqtt/index.html);

You can find a complete Rust code example for using outbound MQTT from an HTTP component in the [Spin Rust SDK repository on GitHub](https://github.com/spinframework/spin-rust-sdk/tree/main/examples/mqtt-outbound).

Expand Down
4 changes: 2 additions & 2 deletions content/v3/rdbms-storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ The exact detail of calling these operations from your application depends on yo

{{ startTab "Rust"}}

> [**Want to go straight to the reference documentation?** Find it here.](https://docs.rs/spin-sdk/latest/spin_sdk/index.html)
> [**Want to go straight to the reference documentation?** Find it here.](https://docs.rs/spin-sdk/5.2.0/spin_sdk/index.html)

MySQL functions are available in the `spin_sdk::mysql` module, and PostgreSQL functions in the `spin_sdk::pg4` module.

Expand Down Expand Up @@ -73,7 +73,7 @@ match rowset.rows.first() {

You can find complete examples for using relational databases in the Spin repository on GitHub ([MySQL](https://github.com/spinframework/spin-rust-sdk/tree/main/examples/mysql), [PostgreSQL](https://github.com/spinframework/spin-rust-sdk/tree/main/examples/postgres)).

For full information about the MySQL and PostgreSQL APIs, see [the Spin SDK reference documentation](https://docs.rs/spin-sdk/latest/spin_sdk/index.html).
For full information about the MySQL and PostgreSQL APIs, see [the Spin SDK reference documentation](https://docs.rs/spin-sdk/5.2.0/spin_sdk/index.html).

{{ blockEnd }}

Expand Down
4 changes: 2 additions & 2 deletions content/v3/redis-outbound.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ The exact detail of calling these operations from your application depends on yo

{{ startTab "Rust"}}

> [**Want to go straight to the reference documentation?** Find it here.](https://docs.rs/spin-sdk/latest/spin_sdk/redis/index.html)
> [**Want to go straight to the reference documentation?** Find it here.](https://docs.rs/spin-sdk/5.2.0/spin_sdk/redis/index.html)

Redis functions are available in the `spin_sdk::redis` module.

Expand All @@ -58,7 +58,7 @@ connection.set("my-key", &"my-value".into());
let data = connection.get("my-key")?;
```

For full details of the Redis API, see the [Spin SDK reference documentation](https://docs.rs/spin-sdk/latest/spin_sdk/redis/index.html);
For full details of the Redis API, see the [Spin SDK reference documentation](https://docs.rs/spin-sdk/5.2.0/spin_sdk/redis/index.html);

**General Notes**

Expand Down
Loading
Loading