Skip to content

Commit

Permalink
Merge pull request #1256 from tpmccallum/update-python-documentation
Browse files Browse the repository at this point in the history
Use Spin SDK 3.1.0 and Componentize-Py 0.13.3
  • Loading branch information
tpmccallum authored Apr 16, 2024
2 parents 9835c14 + 16d2c49 commit 7f1d543
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
19 changes: 13 additions & 6 deletions content/spin/v2/python-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ The Python SDK is built using [`componentize-py`](https://github.com/bytecodeall
<!-- @selectiveCpy -->

```bash
$ pip3 install componentize-py==0.12.0
$ pip3 install componentize-py==0.13.3
```

> **Please note:** The `hello-world` sample below installs `componentize-py` automatically via the `pip3 install -r requirements.txt` command - so feel free to skip this step if you are following the `hello-world` sample with us.
Expand Down Expand Up @@ -127,7 +127,15 @@ The `requirements.txt`, by default, contains the references to the `spin-sdk` an
<!-- @selectiveCpy -->

```bash
$ pip3 install -r requirements.txt
$ pip3 install -r requirements.txt
Collecting spin-sdk==3.1.0 (from -r requirements.txt (line 1))
Using cached spin_sdk-3.1.0-py3-none-any.whl.metadata (16 kB)
Collecting componentize-py==0.13.3 (from -r requirements.txt (line 2))
Using cached componentize_py-0.13.3-cp37-abi3-macosx_10_12_x86_64.whl.metadata (3.4 kB)
Using cached spin_sdk-3.1.0-py3-none-any.whl (94 kB)
Using cached componentize_py-0.13.3-cp37-abi3-macosx_10_12_x86_64.whl (38.8 MB)
Installing collected packages: spin-sdk, componentize-py
Successfully installed componentize-py-0.13.3 spin-sdk-3.1.0
```

## Structure of a Python Component
Expand Down Expand Up @@ -174,15 +182,14 @@ Building a Spin HTTP component using the Python SDK means defining a top-level c
<!-- @nocpy -->

```python
from spin_sdk import http
from spin_sdk.http import Request, Response
from spin_sdk.http import IncomingHandler, Request, Response

class IncomingHandler(http.IncomingHandler):
class IncomingHandler(IncomingHandler):
def handle_request(self, request: Request) -> Response:
return Response(
200,
{"content-type": "text/plain"},
bytes("Hello from the Python SDK!", "utf-8")
bytes("Hello from Python!", "utf-8")
)
```

Expand Down
3 changes: 0 additions & 3 deletions content/wasm-languages/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ url = "https://github.com/fermyon/developer/blob/main/content/wasm-languages/pyt
---

Python is one of the most popular programming languages in the world, and its WebAssembly implementation seems to be coming along quickly.
While it is not yet ready for use, we anticipate it will be functional in the first half of 2022.

The most momentum is in the CPython community, which is approaching both Emscripten-based and WASI-based implementations.

## Available Implementations

Expand Down

0 comments on commit 7f1d543

Please sign in to comment.