Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 2 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@ jobs:
- name: Install Spin
uses: fermyon/actions/spin/setup@v1
with:
# TODO: Switch to Spin 4.0 when it's available
version: "canary"
version: "v4.1.0"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we can remove this as without a version specified, it will download the latest version and we do not have to update it with every spin release.

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.

True, but I'd prefer to avoid dependencies like this changing from one CI run to the next; it makes things less deterministic and predictable.


- name: Build examples and run tests
run: |
python -m venv venv
source venv/bin/activate
pip install componentize-py==0.23.0 http-router==4.1.2 build==1.4.2 mypy==1.13
pip install componentize-py==0.25.1 http-router==4.1.2 build==1.4.2 mypy==1.13
python -m build
VERSION=$(yq '.project.version' pyproject.toml)
pip install dist/spin_sdk-${VERSION//-}-py3-none-any.whl
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

- Python
- `pip`
- `componentize-py` 0.23.0
- `componentize-py` 0.25.1

Once you have `pip` installed, you can install `componentize-py` using:

```bash
pip install componentize-py==0.23.0
pip install componentize-py==0.25.1
```

### Generating the bindings
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ enter a virtual environment and then install the desired packages
```shell
python -m venv .venv
source .venv/bin/activate
pip install componentize-py==0.23.0 spin-sdk==4.0.0 mypy==1.8.0
pip install componentize-py==0.25.1 spin-sdk==5.0.0 mypy==1.8.0
```

### Hello, World
Expand All @@ -48,7 +48,7 @@ component = "hello"
[component.hello]
source = "app.wasm"
[component.hello.build]
command = "componentize-py -w spin:up/http-trigger@4.0.0 componentize app -o app.wasm"
command = "componentize-py -w spin:up/http-trigger@4.1.0 componentize app -o app.wasm"
EOF
```

Expand Down
4 changes: 2 additions & 2 deletions examples/external-lib-example/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
spin-sdk == 4.0.0
componentize-py == 0.23.0
spin-sdk == 5.0.0
componentize-py == 0.25.1
http-router == 4.1.2
2 changes: 1 addition & 1 deletion examples/external-lib-example/spin.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ component = "test"
source = "app.wasm"
allowed_outbound_hosts = []
[component.test.build]
command = "componentize-py -w spin:up/http-trigger@4.0.0 componentize app -o app.wasm"
command = "componentize-py -w spin:up/http-trigger@4.1.0 componentize app -o app.wasm"
4 changes: 2 additions & 2 deletions examples/hello/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
spin-sdk == 4.0.0
componentize-py == 0.23.0
spin-sdk == 5.0.0
componentize-py == 0.25.1
2 changes: 1 addition & 1 deletion examples/hello/spin.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ component = "test"
source = "app.wasm"
allowed_outbound_hosts = []
[component.test.build]
command = "componentize-py -w spin:up/http-trigger@4.0.0 componentize app -o app.wasm"
command = "componentize-py -w spin:up/http-trigger@4.1.0 componentize app -o app.wasm"
4 changes: 2 additions & 2 deletions examples/matrix-math/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
spin-sdk == 4.0.0
componentize-py == 0.23.0
spin-sdk == 5.0.0
componentize-py == 0.25.1
2 changes: 1 addition & 1 deletion examples/matrix-math/spin.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ component = "test"
source = "app.wasm"
allowed_outbound_hosts = []
[component.test.build]
command = "componentize-py -w spin:up/http-trigger@4.0.0 componentize app -o app.wasm"
command = "componentize-py -w spin:up/http-trigger@4.1.0 componentize app -o app.wasm"
4 changes: 2 additions & 2 deletions examples/outgoing-request/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
spin-sdk == 4.0.0
componentize-py == 0.23.0
spin-sdk == 5.0.0
componentize-py == 0.25.1
2 changes: 1 addition & 1 deletion examples/outgoing-request/spin.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ component = "test"
source = "app.wasm"
allowed_outbound_hosts = ["http://*:*", "https://*:*"]
[component.test.build]
command = "componentize-py -w spin:up/http-trigger@4.0.0 componentize app -o app.wasm"
command = "componentize-py -w spin:up/http-trigger@4.1.0 componentize app -o app.wasm"
4 changes: 2 additions & 2 deletions examples/redis-trigger/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
spin-sdk == 4.0.0
componentize-py == 0.23.0
spin-sdk == 5.0.0
componentize-py == 0.25.1
4 changes: 2 additions & 2 deletions examples/spin-kv/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
spin-sdk == 4.0.0
componentize-py == 0.23.0
spin-sdk == 5.0.0
componentize-py == 0.25.1
2 changes: 1 addition & 1 deletion examples/spin-kv/spin.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ source = "app.wasm"
allowed_outbound_hosts = []
key_value_stores = ["default"]
[component.test.build]
command = "componentize-py -w spin:up/http-trigger@4.0.0 componentize app -o app.wasm"
command = "componentize-py -w spin:up/http-trigger@4.1.0 componentize app -o app.wasm"
4 changes: 2 additions & 2 deletions examples/spin-llm/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
spin-sdk == 4.0.0
componentize-py == 0.23.0
spin-sdk == 5.0.0
componentize-py == 0.25.1
2 changes: 1 addition & 1 deletion examples/spin-llm/spin.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ source = "app.wasm"
allowed_outbound_hosts = []
ai_models = ["all-minilm-l6-v2"]
[component.test.build]
command = "componentize-py -w spin:up/http-trigger@4.0.0 componentize app -o app.wasm"
command = "componentize-py -w spin:up/http-trigger@4.1.0 componentize app -o app.wasm"
4 changes: 2 additions & 2 deletions examples/spin-mysql/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

class HttpHandler(http.Handler):
async def handle_request(self, request: Request) -> Response:
with mysql.open("mysql://root:@127.0.0.1/spin_dev") as db:
print(db.query("select * from test", []))
with await mysql.open("mysql://root:@127.0.0.1/spin_dev") as db:
print(await db.query("select * from test", []))

return Response(
200,
Expand Down
4 changes: 2 additions & 2 deletions examples/spin-mysql/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
spin-sdk == 4.0.0
componentize-py == 0.23.0
spin-sdk == 5.0.0
componentize-py == 0.25.1
2 changes: 1 addition & 1 deletion examples/spin-mysql/spin.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ component = "test"
source = "app.wasm"
allowed_outbound_hosts = ["*://*:*"]
[component.test.build]
command = "componentize-py -w spin:up/http-trigger@4.0.0 componentize app -o app.wasm"
command = "componentize-py -w spin:up/http-trigger@4.1.0 componentize app -o app.wasm"
4 changes: 2 additions & 2 deletions examples/spin-outbound-mqtt/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
spin-sdk == 4.0.0
componentize-py == 0.23.0
spin-sdk == 5.0.0
componentize-py == 0.25.1
2 changes: 1 addition & 1 deletion examples/spin-outbound-mqtt/spin.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ component = "test"
source = "app.wasm"
allowed_outbound_hosts = ["*://*:*"]
[component.test.build]
command = "componentize-py -w spin:up/http-trigger@4.0.0 componentize app -o app.wasm"
command = "componentize-py -w spin:up/http-trigger@4.1.0 componentize app -o app.wasm"
4 changes: 2 additions & 2 deletions examples/spin-postgres/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
spin-sdk == 4.0.0
componentize-py == 0.23.0
spin-sdk == 5.0.0
componentize-py == 0.25.1
2 changes: 1 addition & 1 deletion examples/spin-postgres/spin.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ component = "test"
source = "app.wasm"
allowed_outbound_hosts = ["*://*:*"]
[component.test.build]
command = "componentize-py -w spin:up/http-trigger@4.0.0 componentize app -o app.wasm"
command = "componentize-py -w spin:up/http-trigger@4.1.0 componentize app -o app.wasm"
4 changes: 2 additions & 2 deletions examples/spin-redis/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
spin-sdk == 4.0.0
componentize-py == 0.23.0
spin-sdk == 5.0.0
componentize-py == 0.25.1
2 changes: 1 addition & 1 deletion examples/spin-redis/spin.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ source = "app.wasm"
allowed_outbound_hosts = ["redis://*:*"]
ai_models = ["llama2-chat"]
[component.test.build]
command = "componentize-py -w spin:up/http-trigger@4.0.0 componentize app -o app.wasm"
command = "componentize-py -w spin:up/http-trigger@4.1.0 componentize app -o app.wasm"
4 changes: 2 additions & 2 deletions examples/spin-sqlite/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
spin-sdk == 4.0.0
componentize-py == 0.23.0
spin-sdk == 5.0.0
componentize-py == 0.25.1
2 changes: 1 addition & 1 deletion examples/spin-sqlite/spin.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ source = "app.wasm"
sqlite_databases = ["default"]
ai_models = ["llama2-chat"]
[component.test.build]
command = "componentize-py -w spin:up/http-trigger@4.0.0 componentize app -o app.wasm"
command = "componentize-py -w spin:up/http-trigger@4.1.0 componentize app -o app.wasm"
4 changes: 2 additions & 2 deletions examples/spin-variables/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
spin-sdk == 4.0.0
componentize-py == 0.23.0
spin-sdk == 5.0.0
componentize-py == 0.25.1
2 changes: 1 addition & 1 deletion examples/spin-variables/spin.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ allowed_outbound_hosts = []
[component.test.variables]
message = "hello, world!"
[component.test.build]
command = "componentize-py -w spin:up/http-trigger@4.0.0 componentize app -o app.wasm"
command = "componentize-py -w spin:up/http-trigger@4.1.0 componentize app -o app.wasm"
8 changes: 4 additions & 4 deletions examples/streaming/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
from componentize_py_async_support.futures import FutureReader
from spin_sdk import wit
from spin_sdk.wit import exports
from spin_sdk.wit.imports import wasi_http_client_0_3_0_rc_2026_03_15 as client
from spin_sdk.wit.imports.wasi_http_types_0_3_0_rc_2026_03_15 import (
from spin_sdk.wit.imports import wasi_http_client_0_3_0 as client
from spin_sdk.wit.imports.wasi_http_types_0_3_0 import (
Method_Get,
Method_Post,
Scheme,
Expand Down Expand Up @@ -127,8 +127,8 @@ async def sha256(url: str) -> tuple[str, str]:


def trailers_future() -> FutureReader[Result[Optional[Fields], ErrorCode]]:
return wit.result_option_wasi_http_types_0_3_0_rc_2026_03_15_fields_wasi_http_types_0_3_0_rc_2026_03_15_error_code_future(lambda: Ok(None))[1]
return wit.result_option_wasi_http_types_0_3_0_fields_wasi_http_types_0_3_0_error_code_future(lambda: Ok(None))[1]


def unit_future() -> FutureReader[Result[None, ErrorCode]]:
return wit.result_unit_wasi_http_types_0_3_0_rc_2026_03_15_error_code_future(lambda: Ok(None))[1]
return wit.result_unit_wasi_http_types_0_3_0_error_code_future(lambda: Ok(None))[1]
4 changes: 2 additions & 2 deletions examples/streaming/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
spin-sdk == 4.0.0
componentize-py == 0.23.0
spin-sdk == 5.0.0
componentize-py == 0.25.1
2 changes: 1 addition & 1 deletion examples/streaming/spin.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ component = "test"
source = "app.wasm"
allowed_outbound_hosts = ["http://*:*", "https://*:*"]
[component.test.build]
command = "componentize-py -w wasi:http/service@0.3.0-rc-2026-03-15 componentize app -o app.wasm"
command = "componentize-py -w wasi:http/service@0.3.0 componentize app -o app.wasm"
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "spin-sdk"
version = "4.0.0"
version = "5.0.0"
description = "Python SDK for Spin"
readme = "README.md"
license-files = [ "LICENSE" ]
Expand Down
10 changes: 5 additions & 5 deletions regenerate_bindings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

componentize-py \
-d src/spin_sdk/wit \
-w "spin:up/http-trigger@4.0.0" \
-w "spin:up/redis-trigger@4.0.0" \
-w "wasi:http/service@0.3.0-rc-2026-03-15" \
-w "spin:up/http-trigger@4.1.0" \
-w "spin:up/redis-trigger@4.1.0" \
-w "wasi:http/service@0.3.0" \
-w "fermyon:spin/http-trigger@3.0.0" \
-w "fermyon:spin/redis-trigger" \
--export-interface-name "wasi:http/handler@0.3.0-rc-2026-03-15=http-handler" \
--export-interface-name "wasi:http/handler@0.3.0=http-handler" \
--export-interface-name "spin:redis/inbound-redis@3.0.0=redis-handler" \
--world-module spin_sdk.wit \
--full-names \
bindings \
bindings
rm -r src/spin_sdk/wit/imports src/spin_sdk/wit/exports src/componentize_py_*
rm -r src/spin_sdk/wit/__init__.py src/spin_sdk/wit/imports src/spin_sdk/wit/exports src/componentize_py_*
mv bindings/spin_sdk/wit/* src/spin_sdk/wit/
mv bindings/componentize_py_* src/
# `pdoc3` needs to be able to load all modules in order to generate docs, so we
Expand Down
41 changes: 41 additions & 0 deletions src/componentize_py_async_support/__init__.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading