Skip to content

Commit

Permalink
Merge pull request #1171 from itowlson/fix-broken-links-python-sdk-an…
Browse files Browse the repository at this point in the history
…d-wit

Fix Python SDK and WIT links
  • Loading branch information
itowlson authored Feb 13, 2024
2 parents 1d062e9 + eaa8bdb commit 42fcd4c
Show file tree
Hide file tree
Showing 14 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion content/spin/v1/http-outbound.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ response = http_send(
* Request and response headers are dictionaries.
* Errors are signalled through exceptions.

You can find a complete example for using outbound HTTP in the [Python SDK repository on GitHub](https://github.com/fermyon/spin-python-sdk/tree/main/examples/outbound_http).
You can find a complete example for using outbound HTTP in the [Python SDK repository on GitHub](https://github.com/fermyon/spin-python-sdk/tree/old-sdk/examples/outbound_http).

{{ blockEnd }}

Expand Down
2 changes: 1 addition & 1 deletion content/spin/v1/python-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ content-length: 25
Hello from the Python SDK
```

> **Please note:** All examples from this documentation page can be found in [the Python SDK repository on GitHub](https://github.com/fermyon/spin-python-sdk/tree/main/examples). If you are following along with these examples and don't get the desired result perhaps compare your own code with our previously built examples (mentioned above). Also please feel free to reach out on [Discord](https://discord.gg/AAFNfS7NGf) if you have any questions or need any additional support.
> **Please note:** All examples from this documentation page can be found in [the Python SDK repository on GitHub](https://github.com/fermyon/spin-python-sdk/tree/old-sdk/examples). If you are following along with these examples and don't get the desired result perhaps compare your own code with our previously built examples (mentioned above). Also please feel free to reach out on [Discord](https://discord.gg/AAFNfS7NGf) if you have any questions or need any additional support.
## An Outbound HTTP Example

Expand Down
2 changes: 1 addition & 1 deletion content/spin/v1/redis-outbound.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ value = redis_get(address, key)
* Lists are passed and returned as Python lists.
* Errors are signalled through exceptions.

You can find a complete Python code example for using outbound Redis from an HTTP component in the [Python SDK repository on GitHub](https://github.com/fermyon/spin-python-sdk/tree/main/examples/outbound_redis). Please also see this, related, [outbound Redis (using Python) section](./python-components#an-outbound-redis-example).
You can find a complete Python code example for using outbound Redis from an HTTP component in the [Python SDK repository on GitHub](https://github.com/fermyon/spin-python-sdk/tree/old-sdk/examples/outbound_redis). Please also see this, related, [outbound Redis (using Python) section](./python-components#an-outbound-redis-example).

{{ blockEnd }}

Expand Down
6 changes: 3 additions & 3 deletions content/spin/v2/http-outbound.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ You can find a complete example of using outbound HTTP in the JavaScript SDK rep

{{ startTab "Python"}}

> [**Want to go straight to the reference documentation?** Find it here.](https://fermyon.github.io/spin-python-sdk/spin_http.html)
> [**Want to go straight to the reference documentation?** Find it here.](https://fermyon.github.io/spin-python-sdk/v1/spin_http.html)
HTTP functions and classes are available in the `spin_http` module. The function name is [`http_send`](https://fermyon.github.io/spin-python-sdk/spin_http.html#spin_sdk.spin_http.http_send). The [request type](https://fermyon.github.io/spin-python-sdk/spin_http.html#spin_sdk.spin_http.Request) is `Request`, and the [response type](https://fermyon.github.io/spin-python-sdk/spin_http.html#spin_sdk.spin_http.Response) is `Response`. For example:
HTTP functions and classes are available in the `spin_http` module. The function name is [`http_send`](https://fermyon.github.io/spin-python-sdk/v1/spin_http.html#spin_sdk.spin_http.http_send). The [request type](https://fermyon.github.io/spin-python-sdk/v1/spin_http.html#spin_sdk.spin_http.Request) is `Request`, and the [response type](https://fermyon.github.io/spin-python-sdk/v1/spin_http.html#spin_sdk.spin_http.Response) is `Response`. For example:

```python
from spin_http import Request, Response, http_send
Expand All @@ -123,7 +123,7 @@ response = http_send(
* Request and response headers are dictionaries.
* Errors are signalled through exceptions.

You can find a complete example for using outbound HTTP in the [Python SDK repository on GitHub](https://github.com/fermyon/spin-python-sdk/tree/main/examples/outbound_http).
You can find a complete example for using outbound HTTP in the [Python SDK repository on GitHub](https://github.com/fermyon/spin-python-sdk/tree/old-sdk/examples/outbound_http).

{{ blockEnd }}

Expand Down
8 changes: 4 additions & 4 deletions content/spin/v2/http-trigger.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ export const handleRequest: HandleRequest = async function(request: HttpRequest)

{{ startTab "Python"}}

> [**Want to go straight to the reference documentation?** Find it here.](https://fermyon.github.io/spin-python-sdk/)
> [**Want to go straight to the reference documentation?** Find it here.](https://fermyon.github.io/spin-python-sdk/v1)
In Python, the handler is identified by name. It must be called `handle_request`. It takes a request object and must return an instance of `Response`, defined in the `spin_http` package:

Expand Down Expand Up @@ -357,11 +357,11 @@ As well as any headers passed by the client, Spin sets several headers on the re

For the most part, you'll build HTTP component modules using a language SDK (see the Language Guides section), such as a JavaScript module or a Rust crate. If you're interested in what happens inside the SDK, or want to implement HTTP components in another language, read on!

The HTTP component interface is defined using a WebAssembly Interface (WIT) file. ([Learn more about the WIT language here.](https://component-model.bytecodealliance.org/design/wit.html)). You can find the latest WITs for Spin HTTP components at [https://github.com/fermyon/spin/tree/main/wit](https://github.com/fermyon/spin/tree/main/wit).
The HTTP component interface is defined using a WebAssembly Interface (WIT) file. ([Learn more about the WIT language here.](https://component-model.bytecodealliance.org/design/wit.html)). You can find the latest WITs for Spin HTTP components at [https://github.com/fermyon/spin/tree/main/wit](https://github.com/fermyon/spin/tree/main/wit-0.2.0).

The HTTP types and interfaces are defined in [https://github.com/fermyon/spin/tree/main/wit/deps/http](https://github.com/fermyon/spin/tree/main/wit/deps/http), which tracks [the `wasi-http` specification](https://github.com/WebAssembly/wasi-http).
The HTTP types and interfaces are defined in [https://github.com/fermyon/spin/tree/main/wit-0.2.0/deps/http](https://github.com/fermyon/spin/tree/main/wit-0.2.0/deps/http), which tracks [the `wasi-http` specification](https://github.com/WebAssembly/wasi-http).

In particular, the entry point for Spin HTTP components is defined in [the `incoming-handler` interface](https://github.com/fermyon/spin/blob/main/wit/deps/http/incoming-handler.wit):
In particular, the entry point for Spin HTTP components is defined in [the `incoming-handler` interface](https://github.com/fermyon/spin/blob/main/wit-0.2.0/deps/http/handler.wit):

<!-- @nocpy -->

Expand Down
2 changes: 1 addition & 1 deletion content/spin/v2/key-value-store-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ $ spin new -t http-rust spin-key-value
```bash
$ spin new -t http-ts spin-key-value

# Reference: https://github.com/fermyon/spin-python-sdk/tree/main/examples/KV
# Reference: https://github.com/fermyon/spin-python-sdk/tree/old-sdk/examples/KV
```

{{ blockEnd }}
Expand Down
4 changes: 2 additions & 2 deletions content/spin/v2/kv-store-api-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export const handleRequest: HandleRequest = async function (request: HttpRequest
{{ startTab "Python"}}
> [**Want to go straight to the reference documentation?** Find it here.](https://fermyon.github.io/spin-python-sdk/spin_key_value.html)
> [**Want to go straight to the reference documentation?** Find it here.](https://fermyon.github.io/spin-python-sdk/v1/spin_key_value.html)
The key value functions are provided through the `spin_key_value` module in the Python SDK. For example:
Expand All @@ -144,7 +144,7 @@ def handle_request(request):
**General Notes**
- The Python SDK doesn't surface the `close` operation. It automatically closes all stores at the end of the request; there's no way to close them early.
[`get` **Operation**](https://fermyon.github.io/spin-python-sdk/spin_key_value.html#spin_sdk.spin_key_value.Store.get)
[`get` **Operation**](https://fermyon.github.io/spin-python-sdk/v1/spin_key_value.html#spin_sdk.spin_key_value.Store.get)
- If a key does not exist, it returns `None`
{{ blockEnd }}
Expand Down
2 changes: 1 addition & 1 deletion content/spin/v2/language-support-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ This page contains information about language support for Spin features:

{{ startTab "Python"}}

**[📄 Visit the Python Spin SDK reference documentation](https://fermyon.github.io/spin-python-sdk/) to see specific modules, functions, variables and syntax relating to the following Python SDK.**
**[📄 Visit the Python Spin SDK reference documentation](https://fermyon.github.io/spin-python-sdk/v1) to see specific modules, functions, variables and syntax relating to the following Python SDK.**

| Feature | SDK Supported? |
|-----|-----|
Expand Down
4 changes: 2 additions & 2 deletions content/spin/v2/python-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ With <a href="https://www.python.org/" target="_blank">Python</a> being a very p
> This guide assumes you are familiar with the Python programming language, but if you are just getting started, be sure to check out <a href="https://docs.python.org/3/" target="_blank">the official Python documentation</a> and comprehensive <a href="https://docs.python.org/3/reference/" target="_blank">language reference</a>.
[**Want to go straight to the Spin SDK reference documentation?** Find it here.](https://fermyon.github.io/spin-python-sdk/)
[**Want to go straight to the Spin SDK reference documentation?** Find it here.](https://fermyon.github.io/spin-python-sdk/v1)

**Please note:** There is a blog article [introducing the release of this Spin Python SDK](https://www.fermyon.com/blog/spin-python-sdk) if you are interested in some further reading; in addition to this technical documentation.

Expand Down Expand Up @@ -198,7 +198,7 @@ content-length: 25
Hello from the Python SDK
```

> **Please note:** All examples from this documentation page can be found in [the Python SDK repository on GitHub](https://github.com/fermyon/spin-python-sdk/tree/main/examples). If you are following along with these examples and don't get the desired result perhaps compare your own code with our previously built examples (mentioned above). Also please feel free to reach out on [Discord](https://discord.gg/AAFNfS7NGf) if you have any questions or need any additional support.
> **Please note:** All examples from this documentation page can be found in [the Python SDK repository on GitHub](https://github.com/fermyon/spin-python-sdk/tree/old-sdk/examples). If you are following along with these examples and don't get the desired result perhaps compare your own code with our previously built examples (mentioned above). Also please feel free to reach out on [Discord](https://discord.gg/AAFNfS7NGf) if you have any questions or need any additional support.
## An Outbound HTTP Example

Expand Down
6 changes: 3 additions & 3 deletions content/spin/v2/redis-outbound.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ You can find a complete TypeScript example for using outbound Redis from an HTTP

{{ startTab "Python"}}

> [**Want to go straight to the reference documentation?** Find it here.](https://fermyon.github.io/spin-python-sdk/spin_redis.html)
> [**Want to go straight to the reference documentation?** Find it here.](https://fermyon.github.io/spin-python-sdk/v1/spin_redis.html)
Redis functions are available in [the `spin_redis` module](https://fermyon.github.io/spin-python-sdk/spin_redis.html). The function names are prefixed `redis_`. You must pass the Redis instance address to _each_ operation as its first parameter. For example:
Redis functions are available in [the `spin_redis` module](https://fermyon.github.io/spin-python-sdk/v1/spin_redis.html). The function names are prefixed `redis_`. You must pass the Redis instance address to _each_ operation as its first parameter. For example:

```python
from spin_redis import redis_get
Expand All @@ -134,7 +134,7 @@ value = redis_get(address, key)
* Lists are passed and returned as Python lists.
* Errors are signalled through exceptions.

You can find a complete Python code example for using outbound Redis from an HTTP component in the [Python SDK repository on GitHub](https://github.com/fermyon/spin-python-sdk/tree/main/examples/outbound_redis). Please also see this, related, [outbound Redis (using Python) section](./python-components#an-outbound-redis-example).
You can find a complete Python code example for using outbound Redis from an HTTP component in the [Python SDK repository on GitHub](https://github.com/fermyon/spin-python-sdk/tree/old-sdk/examples/outbound_redis). Please also see this, related, [outbound Redis (using Python) section](./python-components#an-outbound-redis-example).

{{ blockEnd }}

Expand Down
4 changes: 2 additions & 2 deletions content/spin/v2/redis-trigger.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ func main() {}

For the most part, you'll build Redis component modules using a language SDK (see the Language Guides section), such as a Rust crate or Go package. If you're interested in what happens inside the SDK, or want to implement Redis components in another language, read on!

The Redis component interface is defined using a WebAssembly Interface (WIT) file. ([Learn more about the WIT language here.](https://component-model.bytecodealliance.org/design/wit.html)). You can find the latest WITs for Spin Redis components at [https://github.com/fermyon/spin/tree/main/wit](https://github.com/fermyon/spin/tree/main/wit).
The Redis component interface is defined using a WebAssembly Interface (WIT) file. ([Learn more about the WIT language here.](https://component-model.bytecodealliance.org/design/wit.html)). You can find the latest WITs for Spin Redis components at [https://github.com/fermyon/spin/tree/main/wit-0.2.0](https://github.com/fermyon/spin/tree/main/wit-0.2.0).

In particular, the entry point for Spin Redis components is defined in [the `inbound-redis` interface](https://github.com/fermyon/spin/blob/main/wit/deps/spin%40unversioned/inbound-redis.wit):
In particular, the entry point for Spin Redis components is defined in [the `inbound-redis` interface](https://github.com/fermyon/spin/blob/main/wit-0.2.0/deps/spin%40unversioned/inbound-redis.wit):

<!-- @nocpy -->

Expand Down
8 changes: 4 additions & 4 deletions content/spin/v2/serverless-ai-api-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export const handleRequest: HandleRequest = async function (request: HttpRequest

{{ startTab "Python"}}

> [**Want to go straight to the reference documentation?** Find it here.](https://fermyon.github.io/spin-python-sdk/spin_llm.html)
> [**Want to go straight to the reference documentation?** Find it here.](https://fermyon.github.io/spin-python-sdk/v1/spin_llm.html)
```python
from spin_http import Response
Expand All @@ -165,11 +165,11 @@ def handle_request(request):

**General Notes**

[`llm_infer` operation](https://fermyon.github.io/spin-python-sdk/spin_llm.html#spin_sdk.spin_llm.llm_infer):
[`llm_infer` operation](https://fermyon.github.io/spin-python-sdk/v1/spin_llm.html#spin_sdk.spin_llm.llm_infer):

- It takes in a model name, prompt text, and optionally a [parameter object](https://fermyon.github.io/spin-python-sdk/spin_llm.html#spin_sdk.spin_llm.LLMInferencingParams) to control the inferencing.
- It takes in a model name, prompt text, and optionally a [parameter object](https://fermyon.github.io/spin-python-sdk/v1/spin_llm.html#spin_sdk.spin_llm.LLMInferencingParams) to control the inferencing.
- The model name is passed in as a string (as shown above; `"llama2-chat"`).
- The return value is am [`InferencingResult` object](https://fermyon.github.io/spin-python-sdk/spin_llm.html#spin_sdk.spin_llm.LLMInferencingResult) - use the `text` attribute to get the inferred response.
- The return value is am [`InferencingResult` object](https://fermyon.github.io/spin-python-sdk/v1/spin_llm.html#spin_sdk.spin_llm.LLMInferencingResult) - use the `text` attribute to get the inferred response.

{{ blockEnd }}

Expand Down
6 changes: 3 additions & 3 deletions content/spin/v2/sqlite-api-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ const json = JSON.stringify(result.rows);

{{ startTab "Python"}}

> [**Want to go straight to the reference documentation?** Find it here.](https://fermyon.github.io/spin-python-sdk/spin_sqlite.html)
> [**Want to go straight to the reference documentation?** Find it here.](https://fermyon.github.io/spin-python-sdk/v1/spin_sqlite.html)
To use SQLite functions, use the `spin_sqlite` module in the Python SDK. The [`sqlite_open`](https://fermyon.github.io/spin-python-sdk/spin_sqlite.html#spin_sdk.spin_sqlite.sqlite_open) and [`sqlite_open_default`](https://fermyon.github.io/spin-python-sdk/spin_sqlite.html#spin_sdk.spin_sqlite.sqlite_open_default) functions return a [connection object](https://fermyon.github.io/spin-python-sdk/spin_sqlite.html#spin_sdk.spin_sqlite.SqliteConnection). The connection object provides the [`execute` method](https://fermyon.github.io/spin-python-sdk/spin_sqlite.html#spin_sdk.spin_sqlite.SqliteConnection.execute) as described above. For example:
To use SQLite functions, use the `spin_sqlite` module in the Python SDK. The [`sqlite_open`](https://fermyon.github.io/spin-python-sdk/v1/spin_sqlite.html#spin_sdk.spin_sqlite.sqlite_open) and [`sqlite_open_default`](https://fermyon.github.io/spin-python-sdk/v1/spin_sqlite.html#spin_sdk.spin_sqlite.sqlite_open_default) functions return a [connection object](https://fermyon.github.io/spin-python-sdk/v1/spin_sqlite.html#spin_sdk.spin_sqlite.SqliteConnection). The connection object provides the [`execute` method](https://fermyon.github.io/spin-python-sdk/v1/spin_sqlite.html#spin_sdk.spin_sqlite.SqliteConnection.execute) as described above. For example:

```python
from spin_http import Response
Expand All @@ -162,7 +162,7 @@ def handle_request(request):

**General Notes**
* Parameters are Python values (numbers, strings, and lists). Spin infers the underlying SQL type.
* The `execute` method returns [a `QueryResult` object](https://fermyon.github.io/spin-python-sdk/spin_sqlite.html#spin_sdk.spin_sqlite.QueryResult) with `rows` and `columns` methods. `columns` returns a list of strings representing column names. `rows` is an array of rows, each of which is an array of Python values (as above) in the same order as `columns`.
* The `execute` method returns [a `QueryResult` object](https://fermyon.github.io/spin-python-sdk/v1/spin_sqlite.html#spin_sdk.spin_sqlite.QueryResult) with `rows` and `columns` methods. `columns` returns a list of strings representing column names. `rows` is an array of rows, each of which is an array of Python values (as above) in the same order as `columns`.
* The connection object doesn't surface the `close` function.
* Errors are surfaced as exceptions.

Expand Down
6 changes: 3 additions & 3 deletions content/spin/v2/variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ api_host = "https://my-api.com"

## Using Variables From Applications

The Spin SDK surfaces the Spin configuration interface to your language. The [interface](https://github.com/fermyon/spin/blob/main/wit/variables.wit) consists of one operation:
The Spin SDK surfaces the Spin configuration interface to your language. The [interface](https://github.com/fermyon/spin/blob/main/wit-0.2.0/variables.wit) consists of one operation:

| Operation | Parameters | Returns | Behavior |
|------------|--------------------|---------------------|----------|
Expand Down Expand Up @@ -150,9 +150,9 @@ export const handleRequest: HandleRequest = async function (request: HttpRequest

{{ startTab "Python"}}

> [**Want to go straight to the reference documentation?** Find it here.](https://fermyon.github.io/spin-python-sdk/spin_config.html)
> [**Want to go straight to the reference documentation?** Find it here.](https://fermyon.github.io/spin-python-sdk/v1/spin_config.html)
The config function is available in the `spin_config` package and is named [`config_get`](https://fermyon.github.io/spin-python-sdk/spin_config.html#spin_sdk.spin_config.config_get).
The config function is available in the `spin_config` package and is named [`config_get`](https://fermyon.github.io/spin-python-sdk/v1/spin_config.html#spin_sdk.spin_config.config_get).

> Note that the prefix/suffix is `config` rather than `variables`.
Expand Down

0 comments on commit 42fcd4c

Please sign in to comment.