Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding 4 Python SUH cards #1084

Merged
merged 1 commit into from
Dec 11, 2023
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
22 changes: 22 additions & 0 deletions content/api/hub/sample_bookmarker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
title = "Bookmarker: An AI-powered Bookmarking Web App"
template = "render_hub_content_body"
date = "2023-12-08T00:22:56Z"
content-type = "text/html"
tags = ["python", "serverless-ai", "web", "key-value"]

[extra]
author = "technosophos"
type = "hub_document"
category = "Sample"
language = "Python"
created_at = "2023-12-08T00:22:56Z"
last_updated = "2023-12-08T00:22:56Z"
spin_version = ">v2.0"
summary = "This app uses Fermyon Spin's Python SDK to create and store bookmarks. It uses an LLM to generate a summary of the page."
url = "https://github.com/technosophos/bookmarker"

---

A simple web application that persists bookmarked URLs via key-value store and then generates a summary of each using Fermyon Serverless AI.

Visit the [GitHub repository](https://github.com/technosophos/bookmarker) for instructions on how to get started.
27 changes: 27 additions & 0 deletions content/api/hub/sample_jinja2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
title = "Jinja2 Template Engine and Spin"
template = "render_hub_content_body"
date = "2023-12-08T00:00:00Z"
content-type = "text/html"
tags = ["python", "templating"]

[extra]
author = "fermyon"
type = "hub_document"
category = "Sample"
language = "Python"
created_at = "2023-12-08T00:00:00Z"
last_updated = "2023-13-08T00:00:00Z"
spin_version = ">=v2.0"
summary = "Example of how to load templates off of the filesystem and then render them and serve them back to the client."
url = "https://github.com/technosophos/jinja2-spin-example"
keywords = "python, jinja2"

---

This is an example of using the [Jinja2 template engine](https://jinja.palletsprojects.com/en/3.1.x/) inside of a Fermyon Spin app. You will learn how to load templates off of the filesystem and then render them and serve them back to the client.

Jinja docs:
* Python docs: https://jinja.palletsprojects.com/en/3.1.x/
* Tempalte docs: https://jinja.palletsprojects.com/en/3.1.x/templates/

To get started, please visit the [GitHub repository](https://github.com/technosophos/jinja2-spin-example).
21 changes: 21 additions & 0 deletions content/api/hub/sample_kv_in_python.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
title = "Store JSON Objects with Key Value Store and Spin With Python"
template = "render_hub_content_body"
date = "2023-12-08T00:00:00Z"
content-type = "text/html"
tags = ["python", "key-value", "JSON"]

[extra]
author = "technosophos"
type = "hub_document"
category = "Sample"
language = "Python"
created_at = "2023-12-08T00:00:00Z"
last_updated = "2023-12-083T00:00:00Z"
spin_version = ">v2.0"
summary = "Example using Spin's built-in KV Store to store and retrieve JSON documents in Python."
url = "https://github.com/technosophos/all-kv-functions"
keywords = "python, JSON, key-value"

---

Simple example of how to use Spin's built-in [key-value store](https://developer.fermyon.com/spin/v2/key-value-store-tutorial) to store and retrieve JSON documents in Python.
28 changes: 28 additions & 0 deletions content/api/hub/sample_router.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
title = "Interal HTTP Routing with Python"
template = "render_hub_content_body"
date = "2023-12-08T00:00:00Z"
content-type = "text/html"
tags = ["python", "http", "routing"]

[extra]
author = "technosophos"
type = "hub_document"
category = "Sample"
language = "Python"
created_at = "2023-12-08T00:00:00Z"
last_updated = "2023-12-08T00:00:00Z"
spin_version = ">v2.0"
summary = "A sample that shows how to do internal HTTP routing in a Spin Python application"
url = "https://github.com/technosophos/example-router-py"
keywords = "router, python"

---

This project showcases how to do internal HTTP routing in a Spin Python application. It is similar to [the Spin JS router](https://developer.fermyon.com/spin/v2/javascript-components#routing-in-a-component) as well as the Django router.

If you are interested in extrnal routing (where the routing table is declared in the spin.toml), the [Application Structure guide](https://developer.fermyon.com/spin/v2/spin-application-structure) covers this, as does the [documentation for Spin configuration](https://github.com/technosophos/example-router-py#:~:text=the%20documentation%20for%20Spin%20configuration).

This uses the absolutely fantastic [http_router](https://pypi.org/project/http-router/) project. You will likely want to reference the API docs:
* https://github.com/klen/http-router.

Visit the [GitHub repository](https://github.com/technosophos/example-router-py) for instructions on how to get started
Loading