Skip to content

Commit d91763e

Browse files
authored
update componentize-py and Spin WIT files (#129)
* update `componentize-py` and Spin WIT files This updates to `componentize-py` 0.22.0, which includes support for component model concurrency. It also includes the WIT files for the upcoming Spin 4.0 release. Other changes: - Updated the bindings generation script and moved it into its own file - This includes passing the `--full-names` option to `componentize-py`, ensuring names remain stable for future releases - Ran the above script to regenerate the bindings from the new WIT files - Added a script to build all the examples and test some of them (just one so far) - Added a GitHub workflow to run the above script - Bumped the package version to 4.0.0 and generated docs/v4 - Updated the examples and template Note that the `src/componentize_py_*` files are part of the `componentize-py bindings` output, and I've only checked them in to make `pdoc3` happy. Signed-off-by: Joel Dice <joel.dice@akamai.com> * add `streaming-p3` example Signed-off-by: Joel Dice <joel.dice@akamai.com> * use Spin setup action to install canary in CI Signed-off-by: Joel Dice <joel.dice@akamai.com> * add .gitattributes file Signed-off-by: Joel Dice <joel.dice@akamai.com> --------- Signed-off-by: Joel Dice <joel.dice@akamai.com>
1 parent 9eb2297 commit d91763e

554 files changed

Lines changed: 85699 additions & 448 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
docs/** linguist-generated=true
2+
src/spin_sdk/wit/** linguist-generated=true
3+
src/componentize_py_* linguist-generated=true
4+
src/componentize_py_*/** linguist-generated=true

.github/workflows/build.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
name: Test
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Install Spin
17+
uses: fermyon/actions/spin/setup@v1
18+
with:
19+
# TODO: Switch to Spin 4.0 when it's available
20+
version: "canary"
21+
22+
- name: Build examples and run tests
23+
run: |
24+
python -m venv venv
25+
source venv/bin/activate
26+
pip install componentize-py==0.22.0 http-router==4.1.2 build==1.4.2
27+
python -m build
28+
pip install dist/spin_sdk-4.0.0-py3-none-any.whl
29+
bash run_tests.sh

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
bindings
22
*.wasm
3+
spin-dependencies.wit
4+
examples/matrix-math/numpy*
35
__pycache__
46
.spin
57
src/spin_sdk.egg-info
68
dist
7-
venv/
9+
venv/

CONTRIBUTING.md

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,22 @@
44

55
- Python
66
- `pip`
7-
- `componentize-py` 0.17.2
7+
- `componentize-py` 0.22.0
88

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

1111
```bash
12-
pip install componentize-py==0.17.2
12+
pip install componentize-py==0.22.0
1313
```
1414

1515
### Generating the bindings
1616

17-
The bindings are generated from
18-
[src/spin_sdk/wit/spin.wit](./src/spin_sdk/wit/spin.wit).
17+
The bindings are generated from the WIT files under
18+
[src/spin_sdk/wit](./src/spin_sdk/wit). You can use the `regenerate_bindings.sh`
19+
script to regenerate them:
1920

2021
```bash
21-
componentize-py \
22-
-d src/spin_sdk/wit \
23-
-w spin-all \
24-
--import-interface-name fermyon:spin/postgres@2.0.0=postgres \
25-
--import-interface-name spin:postgres/postgres@3.0.0=spin_postgres_postgres \
26-
--import-interface-name fermyon:spin/sqlite@2.0.0=sqlite \
27-
--world-module spin_sdk.wit \
28-
bindings \
29-
bindings
30-
rm -r src/spin_sdk/wit/imports src/spin_sdk/wit/exports
31-
mv bindings/spin_sdk/wit/* src/spin_sdk/wit/
32-
rm -r bindings
22+
bash regenerate_bindings.sh
3323
```
3424

3525
### Updating docs

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ branch.
1515
- [Python 3.10 or later and pip](https://www.python.org/downloads/)
1616
- [componentize-py](https://pypi.org/project/componentize-py/)
1717
- [spin-sdk](https://pypi.org/project/spin-sdk/)
18-
- [Spin](https://github.com/spinframework/spin) 2.2 or later.
18+
- [Spin](https://github.com/spinframework/spin) 4.0 or later.
1919
- [MyPy](https://pypi.org/project/mypy/) -- This is optional, but useful for during development.
2020

2121
Once you have Python and pip installed, you can use the latter to create and
@@ -24,7 +24,7 @@ enter a virtual environment and then install the desired packages
2424
```shell
2525
python -m venv .venv
2626
source .venv/bin/activate
27-
pip install componentize-py==0.17.2 spin-sdk==3.4.1 mypy==1.8.0
27+
pip install componentize-py==0.22.0 spin-sdk==4.0.0 mypy==1.8.0
2828
```
2929

3030
### Hello, World

0 commit comments

Comments
 (0)