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

Python sdk update #242

Merged
merged 4 commits into from
Feb 11, 2025
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ restate-data

# Go
**/pkg/

# Python
uv.lock
.python-version
5 changes: 5 additions & 0 deletions .tools/update_python_examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@ PROJECT_ROOT="$(dirname "$SELF_PATH")/.."
function search_and_replace_version() {
echo "upgrading Python version of $1 to $NEW_VERSION"
sed -i 's/restate_sdk==[0-9A-Za-z.-]*/restate_sdk=='"$NEW_VERSION"'/' "$1/requirements.txt"
if [ -e "$1/pyproject.toml" ]; then
sed -i 's/restate-sdk==[0-9A-Za-z.-]*/restate-sdk=='"$NEW_VERSION"'/' "$1/pyproject.toml"
fi;
}

search_and_replace_version $PROJECT_ROOT/python/templates/python
search_and_replace_version $PROJECT_ROOT/python/basics
search_and_replace_version $PROJECT_ROOT/python/patterns-use-cases
search_and_replace_version $PROJECT_ROOT/python/tutorials/tour-of-restate-python
search_and_replace_version $PROJECT_ROOT/python/end-to-end-applications/rag-ingestion
search_and_replace_version $PROJECT_ROOT/python/end-to-end-applications/food-ordering/app
2 changes: 1 addition & 1 deletion python/basics/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
hypercorn
restate_sdk==0.4.1
restate_sdk==0.5.0
pydantic
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.venv
__pycache__/
.idea
.venv
venv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
hypercorn
restate_sdk==0.4.1
restate_sdk==0.5.0
flask
requests
kafka-python
1 change: 1 addition & 0 deletions python/end-to-end-applications/rag-ingestion/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
venv
.venv
ollama
**/__pycache__
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
restate_sdk
restate_sdk==0.5.0
hypercorn
minio
langchain
Expand Down
2 changes: 1 addition & 1 deletion python/patterns-use-cases/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
hypercorn
restate_sdk==0.4.1
restate_sdk==0.5.0
pydantic
requests
stripe
20 changes: 19 additions & 1 deletion python/templates/python/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Python Hello World

Python hello world project to get started.

## With `pip`

To get started, create a venv and install the requirements file:

```shell
Expand All @@ -18,4 +22,18 @@ To build a docker image:

```shell
docker build .
```
```

## With [`uv`](https://docs.astral.sh/uv/)

To sync the dependencies:

```shell
uv sync
```

To start the project:

```shell
uv run -m hypercorn --config hypercorn-config.toml example:app
```
13 changes: 13 additions & 0 deletions python/templates/python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[project]
name = "hello-world"
version = "0.1.0"
description = "Example hello world project"
readme = "README.md"
requires-python = ">=3.11"
dependencies = [
"hypercorn>=0.17.3",
"pydantic>=2.10.6",
"restate-sdk==0.5.0",
]


2 changes: 1 addition & 1 deletion python/templates/python/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
hypercorn
restate_sdk==0.4.1
restate_sdk==0.5.0
pydantic
2 changes: 1 addition & 1 deletion python/tutorials/tour-of-restate-python/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
restate_sdk==0.4.1
restate_sdk==0.5.0
hypercorn