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 4d059dba..96357eb9 100755 --- a/.tools/update_python_examples.sh +++ b/.tools/update_python_examples.sh @@ -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 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/.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/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/.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 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/README.md b/python/templates/python/README.md index aa06f2d0..9793c03d 100644 --- a/python/templates/python/README.md +++ b/python/templates/python/README.md @@ -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 @@ -18,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 +``` 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", +] + + 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