Skip to content
Closed
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
1 change: 0 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"terminal.integrated.shell.linux": "/bin/bash",
"python.pythonPath": "/usr/local/bin/python",
"python.linting.enabled": true,
"python.linting.flake8Enabled": true,
"python.linting.mypyEnabled": true,
},

Expand Down
33 changes: 22 additions & 11 deletions .github/workflows/build-push-to-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python 3.9
- uses: actions/checkout@v6
- name: Set up Python 3.10
uses: actions/setup-python@v6
with:
python-version: 3.9
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -30,19 +30,16 @@ jobs:
echo "Source files are not formatted correctly. Run 'tox -e ruff' to autoformat."
exit 1
fi
- name: Run Linter
run: |
tox -e flake8

build:
needs: lint
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python_ver: ["3.9", "3.10", "3.11", "3.12", "3.13"]
python_ver: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python_ver }}
uses: actions/setup-python@v6
with:
Expand All @@ -66,11 +63,11 @@ jobs:
env:
TWINE_USERNAME: "__token__"
steps:
- uses: actions/checkout@v5
- name: Set up Python 3.9
- uses: actions/checkout@v6
- name: Set up Python 3.10
uses: actions/setup-python@v6
with:
python-version: 3.9
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down Expand Up @@ -109,3 +106,17 @@ jobs:
cd ext/dapr-ext-fastapi
python setup.py sdist bdist_wheel
twine upload dist/*
- name: Build and publish dapr-ext-langgraph
env:
TWINE_PASSWORD: ${{ secrets.PYPI_UPLOAD_PASS }}
run: |
cd ext/dapr-ext-langgraph
python setup.py sdist bdist_wheel
twine upload dist/*
- name: Build and publish dapr-ext-strands
env:
TWINE_PASSWORD: ${{ secrets.PYPI_UPLOAD_PASS }}
run: |
cd ext/dapr-ext-strands
python setup.py sdist bdist_wheel
twine upload dist/*
35 changes: 24 additions & 11 deletions .github/workflows/build-tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python 3.9
- uses: actions/checkout@v6
- name: Set up Python 3.10
uses: actions/setup-python@v6
with:
python-version: 3.9
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -34,19 +34,16 @@ jobs:
echo "Source files are not formatted correctly. Run 'tox -e ruff' to autoformat."
exit 1
fi
- name: Run Linter
run: |
tox -e flake8

build:
needs: lint
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python_ver: ["3.9", "3.10", "3.11", "3.12", "3.13"]
python_ver: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python_ver }}
uses: actions/setup-python@v6
with:
Expand All @@ -70,11 +67,11 @@ jobs:
env:
TWINE_USERNAME: "__token__"
steps:
- uses: actions/checkout@v5
- name: Set up Python 3.9
- uses: actions/checkout@v6
- name: Set up Python 3.10
uses: actions/setup-python@v6
with:
python-version: 3.9
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down Expand Up @@ -118,3 +115,19 @@ jobs:
cd ext/dapr-ext-fastapi
python setup.py sdist bdist_wheel
twine upload dist/*
- name: Build and publish dapr-ext-langgraph
if: startsWith(github.ref_name, 'langgraph-v')
env:
TWINE_PASSWORD: ${{ secrets.PYPI_UPLOAD_PASS }}
run: |
cd ext/dapr-ext-langgraph
python setup.py sdist bdist_wheel
twine upload dist/*
- name: Build and publish dapr-ext-strands
if: startsWith(github.ref_name, 'strands-v')
env:
TWINE_PASSWORD: ${{ secrets.PYPI_UPLOAD_PASS }}
run: |
cd ext/dapr-ext-strands
python setup.py sdist bdist_wheel
twine upload dist/*
15 changes: 6 additions & 9 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python 3.9
- uses: actions/checkout@v6
- name: Set up Python 3.10
uses: actions/setup-python@v6
with:
python-version: 3.9
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -36,19 +36,16 @@ jobs:
echo "Source files are not formatted correctly. Run 'tox -e ruff' to autoformat."
exit 1
fi
- name: Run Linter
run: |
tox -e flake8

build:
needs: lint
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python_ver: ["3.9", "3.10", "3.11", "3.12", "3.13"]
python_ver: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python_ver }}
uses: actions/setup-python@v6
with:
Expand All @@ -64,4 +61,4 @@ jobs:
run: |
tox -e py`echo "${{ matrix.python_ver }}" | sed 's/\.//g'`
- name: Upload test coverage
uses: codecov/codecov-action@v5
uses: codecov/codecov-action@v5
2 changes: 1 addition & 1 deletion .github/workflows/dapr-bot-schedule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v5
uses: actions/checkout@v6
- name: Install dependencies
run: pip install PyGithub
- name: Automerge and update
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/fossa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
FOSSA_API_KEY: b88e1f4287c3108c8751bf106fb46db6 # This is a push-only token that is safe to be exposed.
steps:
- name: "Checkout code"
uses: actions/checkout@v5
uses: actions/checkout@v6

- name: "Run FOSSA Scan"
uses: fossas/fossa-action@v1.7.0 # Use a specific version if locking is preferred
Expand Down
16 changes: 11 additions & 5 deletions .github/workflows/validate_examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python_ver: ["3.9", "3.10", "3.11", "3.12", "3.13"]
python_ver: ["3.10", "3.11", "3.12", "3.13"]
steps:
- name: Parse repository_dispatch payload
if: github.event_name == 'repository_dispatch'
Expand All @@ -58,7 +58,7 @@ jobs:
fi

- name: Check out code onto GOPATH
uses: actions/checkout@v5
uses: actions/checkout@v6
with:
repository: ${{ env.CHECKOUT_REPO }}
ref: ${{ env.CHECKOUT_REF }}
Expand All @@ -70,7 +70,7 @@ jobs:
echo "Found $RUNTIME_VERSION"
- name: Determine latest Dapr Cli version
run: |
export CLI_VERSION=$(curl "https://api.github.com/repos/dapr/cli/releases?per_page=1&page=1" --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' | jq '.[0].tag_name'| tr -d '",v')
export CLI_VERSION=$(curl "https://api.github.com/repos/dapr/cli/releases/latest" --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' | jq '.tag_name'| tr -d '",v')
echo "DAPR_CLI_VER=$CLI_VERSION" >> $GITHUB_ENV
echo "Found $CLI_VERSION"
- name: Set up Python ${{ matrix.python_ver }}
Expand All @@ -88,15 +88,21 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: ${{ env.GOVER }}
- name: Set up Llama
run: |
curl -fsSL https://ollama.com/install.sh | sh
nohup ollama serve &
sleep 10
ollama pull llama3.2:latest
- name: Checkout Dapr CLI repo to override dapr command.
uses: actions/checkout@v5
uses: actions/checkout@v6
if: env.DAPR_CLI_REF != ''
with:
repository: dapr/cli
ref: ${{ env.DAPR_CLI_REF }}
path: cli
- name: Checkout Dapr repo to override daprd.
uses: actions/checkout@v5
uses: actions/checkout@v6
if: env.DAPR_REF != ''
with:
repository: dapr/dapr
Expand Down
34 changes: 15 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Dapr SDK for Python

[![PyPI - Version](https://img.shields.io/pypi/v/dapr?style=flat&logo=pypi&logoColor=white&label=Latest%20version)](https://pypi.org/project/dapr/)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/dapr?style=flat&logo=pypi&logoColor=white&label=Downloads)](https://pypi.org/project/dapr/)
[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/dapr/python-sdk/.github%2Fworkflows%2Fbuild.yaml?branch=main&label=Build&logo=github)](https://github.com/dapr/python-sdk/actions/workflows/build.yaml)
[![codecov](https://codecov.io/gh/dapr/python-sdk/branch/main/graph/badge.svg)](https://codecov.io/gh/dapr/python-sdk)
[![GitHub License](https://img.shields.io/github/license/dapr/python-sdk?style=flat&label=License&logo=github)](https://github.com/dapr/python-sdk/blob/main/LICENSE)
[![GitHub issue custom search in repo](https://img.shields.io/github/issues-search/dapr/python-sdk?query=type%3Aissue%20is%3Aopen%20label%3A%22good%20first%20issue%22&label=Good%20first%20issues&style=flat&logo=github)](https://github.com/dapr/python-sdk/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22)
[![Discord](https://img.shields.io/discord/778680217417809931?label=Discord&style=flat&logo=discord)](http://bit.ly/dapr-discord)
[![YouTube Channel Views](https://img.shields.io/youtube/channel/views/UCtpSQ9BLB_3EXdWAUQYwnRA?style=flat&label=YouTube%20views&logo=youtube)](https://youtube.com/@daprdev)
[![PyPI - Version](https://img.shields.io/pypi/v/dapr?style=flat&logo=pypi&logoColor=white&label=Latest%20version)](https://pypi.org/project/dapr/)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/dapr?style=flat&logo=pypi&logoColor=white&label=Downloads)](https://pypi.org/project/dapr/)
[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/dapr/python-sdk/.github%2Fworkflows%2Fbuild.yaml?branch=main&label=Build&logo=github)](https://github.com/dapr/python-sdk/actions/workflows/build.yaml)
[![codecov](https://codecov.io/gh/dapr/python-sdk/branch/main/graph/badge.svg)](https://codecov.io/gh/dapr/python-sdk)
[![GitHub License](https://img.shields.io/github/license/dapr/python-sdk?style=flat&label=License&logo=github)](https://github.com/dapr/python-sdk/blob/main/LICENSE)
[![GitHub issue custom search in repo](https://img.shields.io/github/issues-search/dapr/python-sdk?query=type%3Aissue%20is%3Aopen%20label%3A%22good%20first%20issue%22&label=Good%20first%20issues&style=flat&logo=github)](https://github.com/dapr/python-sdk/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22)
[![Discord](https://img.shields.io/discord/778680217417809931?label=Discord&style=flat&logo=discord)](http://bit.ly/dapr-discord)
[![YouTube Channel Views](https://img.shields.io/youtube/channel/views/UCtpSQ9BLB_3EXdWAUQYwnRA?style=flat&label=YouTube%20views&logo=youtube)](https://youtube.com/@daprdev)
<!-- IGNORE_LINKS -->
[![X (formerly Twitter) Follow](https://img.shields.io/twitter/follow/daprdev?logo=x&style=flat)](https://twitter.com/daprdev)
<!-- END_IGNORE -->
Expand Down Expand Up @@ -86,6 +86,8 @@ pip3 install -e .
pip3 install -e ./ext/dapr-ext-grpc/
pip3 install -e ./ext/dapr-ext-fastapi/
pip3 install -e ./ext/dapr-ext-workflow/
pip3 install -e ./ext/dapr-ext-langgraph/
pip3 install -e ./ext/dapr-ext-strands/
```

3. Install required packages
Expand All @@ -94,31 +96,25 @@ pip3 install -e ./ext/dapr-ext-workflow/
pip3 install -r dev-requirements.txt
```

4. Run linter

```bash
tox -e flake8
```

5. Run autofix
4. Run linter and autofix

```bash
tox -e ruff
```

6. Run unit-test
5. Run unit-test

```bash
tox -e py311
```

7. Run type check
6. Run type check

```bash
tox -e type
```

8. Run examples
7. Run examples

```bash
tox -e examples
Expand Down Expand Up @@ -153,7 +149,7 @@ export DAPR_BRANCH=release-1.16 # Optional, defaults to master
./tools/regen_grpcclient.sh
```

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

## Help & Feedback

Expand Down
1 change: 0 additions & 1 deletion dapr/actor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from dapr.actor.runtime.remindable import Remindable
from dapr.actor.runtime.runtime import ActorRuntime


__all__ = [
'ActorInterface',
'ActorProxy',
Expand Down
5 changes: 2 additions & 3 deletions dapr/actor/client/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
from dapr.actor.runtime._type_utils import get_dispatchable_attrs_from_interface
from dapr.clients import DaprActorClientBase, DaprActorHttpClient
from dapr.clients.retry import RetryPolicy
from dapr.serializers import Serializer, DefaultJSONSerializer
from dapr.conf import settings
from dapr.serializers import DefaultJSONSerializer, Serializer

# Actor factory Callable type hint.
ACTOR_FACTORY_CALLBACK = Callable[[ActorInterface, str, str], 'ActorProxy']
Expand All @@ -35,8 +35,7 @@ def create(
actor_type: str,
actor_id: ActorId,
actor_interface: Optional[Type[ActorInterface]] = None,
) -> 'ActorProxy':
...
) -> 'ActorProxy': ...


class ActorProxyFactory(ActorFactoryBase):
Expand Down
1 change: 0 additions & 1 deletion dapr/actor/runtime/_reminder_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"""

import base64

from datetime import timedelta
from typing import Any, Dict, Optional

Expand Down
7 changes: 3 additions & 4 deletions dapr/actor/runtime/_state_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@
"""

import io
from typing import Any, List, Tuple, Type

from typing import Any, List, Type, Tuple
from dapr.actor.runtime.state_change import StateChangeKind, ActorStateChange
from dapr.actor.runtime.state_change import ActorStateChange, StateChangeKind
from dapr.clients.base import DaprActorClientBase
from dapr.serializers import Serializer, DefaultJSONSerializer

from dapr.serializers import DefaultJSONSerializer, Serializer

# Mapping StateChangeKind to Dapr State Operation
_MAP_CHANGE_KIND_TO_OPERATION = {
Expand Down
Loading
Loading