Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/build-push-to-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python_ver: ["3.10", "3.11", "3.12", "3.13"]
python_ver: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python_ver }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python_ver: ["3.10", "3.11", "3.12", "3.13"]
python_ver: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python_ver }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python_ver: ["3.10", "3.11", "3.12", "3.13"]
python_ver: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python_ver }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/validate_examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python_ver: ["3.10", "3.11", "3.12", "3.13"]
python_ver: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- name: Parse repository_dispatch payload
if: github.event_name == 'repository_dispatch'
Expand All @@ -67,12 +67,12 @@ jobs:
- uses: azure/setup-helm@v4
- name: Determine latest Dapr Runtime version (including prerelease)
run: |
RUNTIME_VERSION=$(curl -s "https://api.github.com/repos/dapr/dapr/releases" | grep '"tag_name"' | head -n 1 | cut -d ':' -f2 | tr -d '",v ')
RUNTIME_VERSION=$(curl -s "https://api.github.com/repos/dapr/dapr/releases" | grep '"tag_name"' | sort -r | head -n 1 | cut -d ':' -f2 | tr -d '",v ')
echo "DAPR_RUNTIME_VER=$RUNTIME_VERSION" >> $GITHUB_ENV
echo "Found $RUNTIME_VERSION"
- name: Determine latest Dapr Cli version (including prerelease)
run: |
CLI_VERSION=$(curl -s "https://api.github.com/repos/dapr/cli/releases" | grep '"tag_name"' | head -n 1 | cut -d ':' -f2 | tr -d '",v ')
CLI_VERSION=$(curl -s "https://api.github.com/repos/dapr/cli/releases" | grep '"tag_name"' | sort -r | head -n 1 | cut -d ':' -f2 | tr -d '",v ')
echo "DAPR_CLI_VER=$CLI_VERSION" >> $GITHUB_ENV
echo "Found $CLI_VERSION"
- name: Set up Python ${{ matrix.python_ver }}
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ This includes the following packages:
### Prerequisites

* [Install Dapr standalone mode](https://github.com/dapr/cli#install-dapr-on-your-local-machine-self-hosted)
* [Install Python 3.9+](https://www.python.org/downloads/)
* [Install Python 3.10+](https://www.python.org/downloads/)

### Install Dapr python sdk

Expand Down Expand Up @@ -145,12 +145,10 @@ The generated files will be found in `docs/_build`.

```sh
pip3 install -r tools/requirements.txt
export DAPR_BRANCH=release-1.16 # Optional, defaults to master
export DAPR_BRANCH=release-1.17 # Optional, defaults to master
./tools/regen_grpcclient.sh
```

> Note: The `grpcio-tools` version we're using doesn't support Python 3.13.

## Help & Feedback

Need help or have feedback on the SDK? Please open a GitHub issue or come chat with us in the `#python-sdk` channel of our Discord server ([click here to join](https://discord.gg/MySdVxrH)).
Expand Down
10 changes: 2 additions & 8 deletions dapr/clients/grpc/_conversation_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
import inspect
import random
import string
import types
from dataclasses import fields, is_dataclass
from enum import Enum
from types import UnionType
from typing import (
Any,
Callable,
Expand All @@ -37,10 +37,6 @@

from dapr.conf import settings

# Make mypy happy. Runtime handle: real class on 3.10+, else None.
# TODO: Python 3.9 is about to be end-of-life, so we can drop this at some point next year (2026)
UnionType: Any = getattr(types, 'UnionType', None)

# duplicated from conversation to avoid circular import
Params = Union[Mapping[str, Any], Sequence[Any], None]

Expand Down Expand Up @@ -857,9 +853,7 @@ def _coerce_literal(value: Any, lit_args: List[Any]) -> Any:

def _is_union(t) -> bool:
origin = get_origin(t)
if origin is Union:
return True
return UnionType is not None and origin is UnionType
return origin is Union or origin is UnionType


def _coerce_and_validate(value: Any, expected_type: Any) -> Any:
Expand Down
6 changes: 3 additions & 3 deletions examples/configuration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ It demonstrates the following APIs:
## Pre-requisites

- [Dapr CLI and initialized environment](https://docs.dapr.io/getting-started)
- [Install Python 3.9+](https://www.python.org/downloads/)
- [Install Python 3.10+](https://www.python.org/downloads/)

## Install Dapr python-SDK

Expand All @@ -18,7 +18,7 @@ It demonstrates the following APIs:
pip3 install dapr dapr-ext-grpc
```

## Store the configuration in configurationstore
## Store the configuration in configurationstore
<!-- STEP
name: Set configuration value
expected_stdout_lines:
Expand All @@ -38,7 +38,7 @@ docker exec dapr_redis redis-cli SET orderId2 "200||1"

Change directory to this folder:
```bash
cd examples/configuration
cd examples/configuration
```

To run this example, use the following command:
Expand Down
2 changes: 1 addition & 1 deletion examples/crypto/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ It creates a client using `DaprClient`, uses a local store defined in
## Pre-requisites

- [Dapr CLI and initialized environment](https://docs.dapr.io/getting-started)
- [Install Python 3.9+](https://www.python.org/downloads/)
- [Install Python 3.10+](https://www.python.org/downloads/)

> In order to run this sample, make sure that OpenSSL is available on your system.

Expand Down
16 changes: 8 additions & 8 deletions examples/demo_actor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This document describes how to create an Actor(DemoActor) and invoke its methods
## Pre-requisites

- [Dapr CLI and initialized environment](https://docs.dapr.io/getting-started)
- [Install Python 3.9+](https://www.python.org/downloads/)
- [Install Python 3.10+](https://www.python.org/downloads/)

### Install requirements

Expand Down Expand Up @@ -138,7 +138,7 @@ expected_stdout_lines:

2. Follow [these steps](https://docs.dapr.io/getting-started/tutorials/configure-state-pubsub/#step-1-create-a-redis-store) to create a Redis store.

3. Once your store is created, confirm validate `redis.yml` file in the `deploy` directory.
3. Once your store is created, confirm validate `redis.yml` file in the `deploy` directory.
> **Note:** the `redis.yml` uses the secret created by `bitmany/redis` Helm chat to securely inject the password.

4. Apply the `redis.yml` file: `kubectl apply -f ./deploy/redis.yml` and observe that your state store was successfully configured!
Expand All @@ -162,17 +162,17 @@ expected_stdout_lines:
```
dapr logs -a demoactor -k
```

Logs for actor service app:
```
kubectl logs -l app="demoactor" -c demoactor
```

Logs for actor client sidecar:
```
dapr logs -a demoactor-client -k
```

Logs for actor service app:
```
kubectl logs -l app="demoactor-client" -c demoactor-client
Expand Down Expand Up @@ -209,9 +209,9 @@ timeout_seconds: 60
cd demo_actor
python -m unittest test_demo_actor.py
```

Expected output (note that the unit test print outputs might not necessarily be in this order - what really matters is that all tests pass anyway):

```
set_my_data: {'state': 5}
has_value: True
Expand All @@ -226,7 +226,7 @@ timeout_seconds: 60
has_value: True
----------------------------------------------------------------------
Ran 5 tests in 0.052s

OK
```

Expand Down
4 changes: 2 additions & 2 deletions examples/demo_actor/demo_actor/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM python:3.9-slim-buster
FROM python:3.10-slim-buster

WORKDIR /app
COPY . .
COPY . .

RUN pip install -r requirements.txt

Expand Down
2 changes: 1 addition & 1 deletion examples/demo_workflow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ It demonstrates the following APIs:
## Pre-requisites

- [Dapr CLI and initialized environment](https://docs.dapr.io/getting-started)
- [Install Python 3.9+](https://www.python.org/downloads/)
- [Install Python 3.10+](https://www.python.org/downloads/)

### Install requirements

Expand Down
4 changes: 2 additions & 2 deletions examples/distributed_lock/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ all the distributed lock API methods available as example.
## Pre-requisites

- [Dapr CLI and initialized environment](https://docs.dapr.io/getting-started)
- [Install Python 3.9+](https://www.python.org/downloads/)
- [Install Python 3.10+](https://www.python.org/downloads/)

## Install Dapr python-SDK

Expand Down Expand Up @@ -60,4 +60,4 @@ The output should be as follows:

The Dapr python-sdk will pass through errors that it receives from the Dapr runtime.

[Distributed Lock component]: https://docs.dapr.io/developing-applications/building-blocks/distributed-lock/
[Distributed Lock component]: https://docs.dapr.io/developing-applications/building-blocks/distributed-lock/
6 changes: 3 additions & 3 deletions examples/error_handling/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

This guide demonstrates handling `DaprGrpcError` errors when using the Dapr python-SDK. It's important to note that not all Dapr gRPC status errors are currently captured and transformed into a `DaprGrpcError` by the SDK. Efforts are ongoing to enhance this aspect, and contributions are welcome. For detailed information on error handling in Dapr, refer to the [official documentation](https://docs.dapr.io/developing-applications/error-codes/).

The example involves creating a DaprClient and invoking the save_state method.
It uses the default configuration from Dapr init in [self-hosted mode](https://github.com/dapr/cli#install-dapr-on-your-local-machine-self-hosted).
The example involves creating a DaprClient and invoking the save_state method.
It uses the default configuration from Dapr init in [self-hosted mode](https://github.com/dapr/cli#install-dapr-on-your-local-machine-self-hosted).

## Pre-requisites

- [Dapr CLI and initialized environment](https://docs.dapr.io/getting-started)
- [Install Python 3.9+](https://www.python.org/downloads/)
- [Install Python 3.10+](https://www.python.org/downloads/)

## Install Dapr python-SDK

Expand Down
14 changes: 7 additions & 7 deletions examples/grpc_proxying/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This example creates a gRPC service using the protobuf file and adds it to the P
## Pre-requisites

- [Dapr CLI and initialized environment](https://docs.dapr.io/getting-started)
- [Install Python 3.9+](https://www.python.org/downloads/)
- [Install Python 3.10+](https://www.python.org/downloads/)

## Install Dapr python-SDK

Expand All @@ -21,7 +21,7 @@ pip3 install dapr dapr-ext-grpc

Run the following command in a terminal/command-prompt:

<!-- STEP
<!-- STEP
name: Run receiver
expected_stdout_lines:
- '== APP == INFO:root:name: "you"'
Expand All @@ -44,7 +44,7 @@ name: Run caller
expected_stdout_lines:
- '== APP == Greeter client received: Hello, you!'
background: true
sleep: 5
sleep: 5
-->


Expand All @@ -58,7 +58,7 @@ dapr run --app-id invoke-caller --dapr-grpc-port 50007 --config config.yaml --
## Cleanup

<!-- STEP
expected_stdout_lines:
expected_stdout_lines:
- '✅ app stopped successfully: invoke-receiver'
name: Shutdown dapr
-->
Expand Down Expand Up @@ -97,17 +97,17 @@ dapr stop --app-id invoke-receiver
```
dapr logs -a invoke-caller -k
```

Logs for caller app:
```
kubectl logs -l app="invokecaller" -c invokecaller
```

Logs for receiver sidecar:
```
dapr logs -a invoke-receiver -k
```

Logs for receiver app:
```
kubectl logs -l app="invokereceiver" -c invokereceiver
Expand Down
10 changes: 5 additions & 5 deletions examples/invoke-binding/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This example utilizes a publisher and a receiver for the InvokeBinding / OnBindi
## Pre-requisites

- [Dapr CLI and initialized environment](https://docs.dapr.io/getting-started)
- [Install Python 3.9+](https://www.python.org/downloads/)
- [Install Python 3.10+](https://www.python.org/downloads/)

## Install Dapr python-SDK

Expand All @@ -26,7 +26,7 @@ name: Kafka install
sleep: 30
-->

1. Start the kafka containers using docker compose
1. Start the kafka containers using docker compose

```bash
docker compose -f ./docker-compose-single-kafka.yml up -d
Expand All @@ -36,15 +36,15 @@ docker compose -f ./docker-compose-single-kafka.yml up -d

<!-- STEP
name: Start Receiver
expected_stdout_lines:
expected_stdout_lines:
- '== APP == {"id": 1, "message": "hello world"}'
- '== APP == {"id": 2, "message": "hello world"}'
- '== APP == {"id": 3, "message": "hello world"}'
background: true
sleep: 5
-->

2. Start Receiver (expose gRPC server receiver on port 50051)
2. Start Receiver (expose gRPC server receiver on port 50051)

```bash
dapr run --app-id receiver --app-protocol grpc --app-port 50051 --resources-path ./components python3 invoke-input-binding.py
Expand All @@ -58,7 +58,7 @@ In another terminal/command-prompt run:

<!-- STEP
name: Start Publisher
expected_stdout_lines:
expected_stdout_lines:
- '== APP == Sending message id: 1, message "hello world"'
- '== APP == Sending message id: 2, message "hello world"'
- '== APP == Sending message id: 3, message "hello world"'
Expand Down
8 changes: 4 additions & 4 deletions examples/invoke-custom-data/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This example utilizes a receiver and a caller for the OnInvoke / Invoke function
## Pre-requisites

- [Dapr CLI and initialized environment](https://docs.dapr.io/getting-started)
- [Install Python 3.9+](https://www.python.org/downloads/)
- [Install Python 3.10+](https://www.python.org/downloads/)

## Install Dapr python-SDK

Expand Down Expand Up @@ -69,10 +69,10 @@ Expected output from caller:
== APP == isSuccess: true
== APP == code: 200
== APP == message: "Hello World - Success!"
== APP ==
== APP ==
```

Expected output from receiver:
Expected output from receiver:

```
== APP == {'user-agent': ['grpc-go/1.33.1'], 'x-forwarded-host': ['MyPC'], 'x-forwarded-for': ['192. 168.1.3'], 'forwarded': ['for=192.168.1.3;by=192.168.1.3; host=MyPC'], 'grpc-trace-bin': [b'\x00\x00\x90Zc\x17\xaav?5)L\xcd]>. \x88>\x01\x81\xe9\x9c\xbd\x01x\xfc\xc5\x02\x01']}
Expand All @@ -82,7 +82,7 @@ Expected output from receiver:
4. Cleanup

<!-- STEP
expected_stdout_lines:
expected_stdout_lines:
- '✅ app stopped successfully: invoke-receiver'
name: Shutdown dapr
-->
Expand Down
Loading
Loading