From 61a067125e8061115212ce7369182362682499fd Mon Sep 17 00:00:00 2001 From: slinkydeveloper Date: Tue, 11 Feb 2025 15:31:07 +0100 Subject: [PATCH 1/4] Fix gitignore of python projects --- python/end-to-end-applications/food-ordering/app/.gitignore | 1 - python/end-to-end-applications/rag-ingestion/.gitignore | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/python/end-to-end-applications/food-ordering/app/.gitignore b/python/end-to-end-applications/food-ordering/app/.gitignore index 4225632d..961dfeb4 100644 --- a/python/end-to-end-applications/food-ordering/app/.gitignore +++ b/python/end-to-end-applications/food-ordering/app/.gitignore @@ -1,5 +1,4 @@ .venv __pycache__/ .idea -.venv venv \ No newline at end of file diff --git a/python/end-to-end-applications/rag-ingestion/.gitignore b/python/end-to-end-applications/rag-ingestion/.gitignore index 7863bdcf..a40ca89b 100644 --- a/python/end-to-end-applications/rag-ingestion/.gitignore +++ b/python/end-to-end-applications/rag-ingestion/.gitignore @@ -1,3 +1,4 @@ venv +.venv ollama **/__pycache__ \ No newline at end of file From e5be8ab143f71241adecc43846aae728b87b1913 Mon Sep 17 00:00:00 2001 From: slinkydeveloper Date: Tue, 11 Feb 2025 15:33:16 +0100 Subject: [PATCH 2/4] Update Python SDK to 0.5.0 --- .tools/update_python_examples.sh | 2 ++ python/basics/requirements.txt | 2 +- .../end-to-end-applications/food-ordering/app/requirements.txt | 2 +- python/end-to-end-applications/rag-ingestion/requirements.txt | 2 +- python/patterns-use-cases/requirements.txt | 2 +- python/templates/python/requirements.txt | 2 +- python/tutorials/tour-of-restate-python/requirements.txt | 2 +- 7 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.tools/update_python_examples.sh b/.tools/update_python_examples.sh index 4d059dba..07de50c8 100755 --- a/.tools/update_python_examples.sh +++ b/.tools/update_python_examples.sh @@ -12,6 +12,8 @@ function search_and_replace_version() { } 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 diff --git a/python/basics/requirements.txt b/python/basics/requirements.txt index a0112ec3..bca8dd4a 100644 --- a/python/basics/requirements.txt +++ b/python/basics/requirements.txt @@ -1,3 +1,3 @@ hypercorn -restate_sdk==0.4.1 +restate_sdk==0.5.0 pydantic \ No newline at end of file diff --git a/python/end-to-end-applications/food-ordering/app/requirements.txt b/python/end-to-end-applications/food-ordering/app/requirements.txt index ff426fe2..50e3ac7f 100644 --- a/python/end-to-end-applications/food-ordering/app/requirements.txt +++ b/python/end-to-end-applications/food-ordering/app/requirements.txt @@ -1,5 +1,5 @@ hypercorn -restate_sdk==0.4.1 +restate_sdk==0.5.0 flask requests kafka-python \ No newline at end of file diff --git a/python/end-to-end-applications/rag-ingestion/requirements.txt b/python/end-to-end-applications/rag-ingestion/requirements.txt index 3e08d161..12df9315 100644 --- a/python/end-to-end-applications/rag-ingestion/requirements.txt +++ b/python/end-to-end-applications/rag-ingestion/requirements.txt @@ -1,4 +1,4 @@ -restate_sdk +restate_sdk==0.5.0 hypercorn minio langchain diff --git a/python/patterns-use-cases/requirements.txt b/python/patterns-use-cases/requirements.txt index 18e85e9d..36e583b5 100644 --- a/python/patterns-use-cases/requirements.txt +++ b/python/patterns-use-cases/requirements.txt @@ -1,5 +1,5 @@ hypercorn -restate_sdk==0.4.1 +restate_sdk==0.5.0 pydantic requests stripe \ No newline at end of file diff --git a/python/templates/python/requirements.txt b/python/templates/python/requirements.txt index a0112ec3..bca8dd4a 100644 --- a/python/templates/python/requirements.txt +++ b/python/templates/python/requirements.txt @@ -1,3 +1,3 @@ hypercorn -restate_sdk==0.4.1 +restate_sdk==0.5.0 pydantic \ No newline at end of file diff --git a/python/tutorials/tour-of-restate-python/requirements.txt b/python/tutorials/tour-of-restate-python/requirements.txt index f4da53e5..3a556735 100644 --- a/python/tutorials/tour-of-restate-python/requirements.txt +++ b/python/tutorials/tour-of-restate-python/requirements.txt @@ -1,2 +1,2 @@ -restate_sdk==0.4.1 +restate_sdk==0.5.0 hypercorn \ No newline at end of file From 20956494e0ff9b523cdfadb27ae928f8db95618e Mon Sep 17 00:00:00 2001 From: slinkydeveloper Date: Tue, 11 Feb 2025 15:53:36 +0100 Subject: [PATCH 3/4] Add `pyproject.toml` and `uv` commands to template --- .gitignore | 4 ++++ .tools/update_python_examples.sh | 3 +++ python/templates/python/README.md | 18 ++++++++++++++++++ python/templates/python/pyproject.toml | 13 +++++++++++++ 4 files changed, 38 insertions(+) create mode 100644 python/templates/python/pyproject.toml diff --git a/.gitignore b/.gitignore index 17a45877..a6cd62a0 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,7 @@ restate-data # Go **/pkg/ + +# Python +uv.lock +.python-version \ No newline at end of file diff --git a/.tools/update_python_examples.sh b/.tools/update_python_examples.sh index 07de50c8..96357eb9 100755 --- a/.tools/update_python_examples.sh +++ b/.tools/update_python_examples.sh @@ -9,6 +9,9 @@ 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 diff --git a/python/templates/python/README.md b/python/templates/python/README.md index aa06f2d0..1f968413 100644 --- a/python/templates/python/README.md +++ b/python/templates/python/README.md @@ -1,5 +1,23 @@ # Python Hello World +Python hello world project to get started. + +## 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 +``` + +## With `pip` + To get started, create a venv and install the requirements file: ```shell diff --git a/python/templates/python/pyproject.toml b/python/templates/python/pyproject.toml new file mode 100644 index 00000000..d9011daf --- /dev/null +++ b/python/templates/python/pyproject.toml @@ -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", +] + + From ca8a4341618981a9e61ad99b2a7a36708e7f1b1a Mon Sep 17 00:00:00 2001 From: slinkydeveloper Date: Tue, 11 Feb 2025 15:58:24 +0100 Subject: [PATCH 4/4] Move pip up in the README --- python/templates/python/README.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/python/templates/python/README.md b/python/templates/python/README.md index 1f968413..9793c03d 100644 --- a/python/templates/python/README.md +++ b/python/templates/python/README.md @@ -2,20 +2,6 @@ Python hello world project to get started. -## 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 -``` - ## With `pip` To get started, create a venv and install the requirements file: @@ -36,4 +22,18 @@ To build a docker image: ```shell docker build . -``` \ No newline at end of file +``` + +## 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 +```