Skip to content
Draft
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 .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ coverage:
ignore:
- dapr/proto # - Generated GRPC client
- tests # - tests
- .tox # - environment
- .venv # - environment
- ext/dapr-ext-fastapi/tests # - fastapi extention tests
32 changes: 19 additions & 13 deletions .github/workflows/build-push-to-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ jobs:
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel tox
run: uv sync --all-packages --group dev
- name: Run Autoformatter
run: |
tox -e ruff
uv run ruff check --fix && uv run ruff format
statusResult=$(git status -u --porcelain)
if [ -z $statusResult ]
if [ -z "$statusResult" ]
then
exit 0
else
echo "Source files are not formatted correctly. Run 'tox -e ruff' to autoformat."
echo "Source files are not formatted correctly. Run 'uv run ruff check --fix && uv run ruff format'."
exit 1
fi

Expand All @@ -44,16 +44,22 @@ jobs:
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python_ver }}
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel tox
run: uv sync --all-packages --group dev
- name: Check Typing
run: |
tox -e type
run: uv run mypy
- name: Run unit-tests
run: |
tox -e py`echo "${{ matrix.python_ver }}" | sed 's/\.//g'`
uv run coverage run -m unittest discover -v ./tests
uv run coverage run -a -m unittest discover -v ./ext/dapr-ext-workflow/tests
uv run coverage run -a -m unittest discover -v ./ext/dapr-ext-grpc/tests
uv run coverage run -a -m unittest discover -v ./ext/dapr-ext-fastapi/tests
uv run coverage run -a -m unittest discover -v ./ext/dapr-ext-langgraph/tests
uv run coverage run -a -m unittest discover -v ./ext/dapr-ext-strands/tests
uv run coverage run -a -m unittest discover -v ./ext/flask_dapr/tests
uv run coverage xml
- name: Upload test coverage
uses: codecov/codecov-action@v5
publish:
Expand All @@ -71,7 +77,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine tox
pip install setuptools wheel twine
- name: Build and publish Dapr Python SDK
Comment on lines 77 to 81
env:
TWINE_PASSWORD: ${{ secrets.PYPI_UPLOAD_PASS }}
Expand Down
32 changes: 19 additions & 13 deletions .github/workflows/build-tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ jobs:
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel tox
run: uv sync --all-packages --group dev
- name: Run Autoformatter
run: |
tox -e ruff
uv run ruff check --fix && uv run ruff format
statusResult=$(git status -u --porcelain)
if [ -z $statusResult ]
if [ -z "$statusResult" ]
then
exit 0
else
echo "Source files are not formatted correctly. Run 'tox -e ruff' to autoformat."
echo "Source files are not formatted correctly. Run 'uv run ruff check --fix && uv run ruff format'."
exit 1
fi

Expand All @@ -50,16 +50,22 @@ jobs:
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python_ver }}
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel tox
run: uv sync --all-packages --group dev
- name: Check Typing
run: |
tox -e type
run: uv run mypy
- name: Run unit-tests
run: |
tox -e py`echo "${{ matrix.python_ver }}" | sed 's/\.//g'`
uv run coverage run -m unittest discover -v ./tests
uv run coverage run -a -m unittest discover -v ./ext/dapr-ext-workflow/tests
uv run coverage run -a -m unittest discover -v ./ext/dapr-ext-grpc/tests
uv run coverage run -a -m unittest discover -v ./ext/dapr-ext-fastapi/tests
uv run coverage run -a -m unittest discover -v ./ext/dapr-ext-langgraph/tests
uv run coverage run -a -m unittest discover -v ./ext/dapr-ext-strands/tests
uv run coverage run -a -m unittest discover -v ./ext/flask_dapr/tests
uv run coverage xml
- name: Upload test coverage
uses: codecov/codecov-action@v5
publish:
Expand All @@ -77,7 +83,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine tox
pip install setuptools wheel twine
- name: Build and publish Dapr Python SDK
Comment on lines 83 to 87
if: startsWith(github.ref_name, 'v')
env:
Expand Down
30 changes: 18 additions & 12 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ jobs:
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel tox
run: uv sync --all-packages --group dev
- name: Run Autoformatter
run: |
tox -e ruff
uv run ruff check --fix && uv run ruff format
statusResult=$(git status -u --porcelain)
if [ -z $statusResult ]
if [ -z "$statusResult" ]
then
exit 0
else
echo "Source files are not formatted correctly. Run 'tox -e ruff' to autoformat."
echo "Source files are not formatted correctly. Run 'uv run ruff check --fix && uv run ruff format'."
exit 1
fi

Expand All @@ -50,15 +50,21 @@ jobs:
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python_ver }}
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel tox
run: uv sync --all-packages --group dev
- name: Check Typing
run: |
tox -e type
run: uv run mypy
- name: Run unit-tests
run: |
tox -e py`echo "${{ matrix.python_ver }}" | sed 's/\.//g'`
uv run coverage run -m unittest discover -v ./tests
uv run coverage run -a -m unittest discover -v ./ext/dapr-ext-workflow/tests
uv run coverage run -a -m unittest discover -v ./ext/dapr-ext-grpc/tests
uv run coverage run -a -m unittest discover -v ./ext/dapr-ext-fastapi/tests
uv run coverage run -a -m unittest discover -v ./ext/dapr-ext-langgraph/tests
uv run coverage run -a -m unittest discover -v ./ext/dapr-ext-strands/tests
uv run coverage run -a -m unittest discover -v ./ext/flask_dapr/tests
uv run coverage xml
- name: Upload test coverage
uses: codecov/codecov-action@v5
30 changes: 26 additions & 4 deletions .github/workflows/validate_examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ jobs:
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python_ver }}
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine tox
run: uv sync --all-packages --group examples
- name: Set up Dapr CLI
run: |
wget -q "https://github.com/dapr/cli/releases/download/v${{ env.DAPR_CLI_VER }}/dapr_${{ env.GOOS }}_${{ env.GOARCH }}.tar.gz" -O /tmp/dapr.tar.gz
Expand Down Expand Up @@ -155,4 +155,26 @@ jobs:
cd ..
- name: Check Examples
run: |
tox -e examples
cd examples
./validate.sh conversation
./validate.sh crypto
./validate.sh metadata
./validate.sh error_handling
./validate.sh pubsub-simple
./validate.sh pubsub-streaming
./validate.sh pubsub-streaming-async
./validate.sh state_store
./validate.sh state_store_query
./validate.sh secret_store
./validate.sh invoke-simple
./validate.sh invoke-custom-data
./validate.sh demo_actor
./validate.sh invoke-binding
./validate.sh grpc_proxying
./validate.sh w3c-tracing
./validate.sh distributed_lock
./validate.sh configuration
./validate.sh workflow
./validate.sh jobs
./validate.sh langgraph-checkpointer
./validate.sh ../
85 changes: 33 additions & 52 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ tools/ # Build and release scripts

## Extension overview

Each extension is a **separate PyPI package** with its own `setup.cfg`, `setup.py`, `tests/`, and `AGENTS.md`.
Each extension is a **separate PyPI package** with its own `pyproject.toml`, `setup.py`, `tests/`, and `AGENTS.md`.

| Extension | Package | Purpose | Active development |
|-----------|---------|---------|-------------------|
Expand All @@ -67,9 +67,8 @@ The `examples/` directory serves as both user-facing documentation and the proje

Quick reference:
```bash
tox -e examples # Run all examples (needs Dapr runtime)
tox -e example-component -- state_store # Run a single example
cd examples && ./validate.sh state_store # Run directly
cd examples && uv run --group examples ./validate.sh state_store # Run a single example
cd examples && uv run --group examples ./validate.sh conversation # Run another example
Comment on lines +70 to +71
```

## Python version support
Expand All @@ -83,47 +82,33 @@ cd examples && ./validate.sh state_store # Run directly
Install all packages in editable mode with dev dependencies:

```bash
pip install -r dev-requirements.txt \
-e . \
-e ext/dapr-ext-workflow/ \
-e ext/dapr-ext-grpc/ \
-e ext/dapr-ext-fastapi/ \
-e ext/dapr-ext-langgraph/ \
-e ext/dapr-ext-strands/ \
-e ext/flask_dapr/
uv sync --all-packages --group dev
```

## Running tests

Tests use Python's built-in `unittest` framework with `coverage`. Run via tox:
Tests use Python's built-in `unittest` framework with `coverage`.

```bash
# Run all unit tests (replace 311 with your Python version)
tox -e py311
# Run all unit tests
uv run python -m unittest discover -v ./tests

# Extension tests (run each separately)
uv run python -m unittest discover -v ./ext/dapr-ext-workflow/tests
uv run python -m unittest discover -v ./ext/dapr-ext-grpc/tests
uv run python -m unittest discover -v ./ext/dapr-ext-fastapi/tests
uv run python -m unittest discover -v ./ext/dapr-ext-langgraph/tests
uv run python -m unittest discover -v ./ext/dapr-ext-strands/tests
uv run python -m unittest discover -v ./ext/flask_dapr/tests

# Run linting and formatting
tox -e ruff
uv run ruff check --fix && uv run ruff format

# Run type checking
tox -e type
uv run mypy

# Validate examples (requires Dapr runtime)
tox -e examples
```

To run tests directly without tox:

```bash
# Core SDK tests
python -m unittest discover -v ./tests

# Extension tests (run each separately)
python -m unittest discover -v ./ext/dapr-ext-workflow/tests
python -m unittest discover -v ./ext/dapr-ext-grpc/tests
python -m unittest discover -v ./ext/dapr-ext-fastapi/tests
python -m unittest discover -v ./ext/dapr-ext-langgraph/tests
python -m unittest discover -v ./ext/dapr-ext-strands/tests
python -m unittest discover -v ./ext/flask_dapr/tests
cd examples && uv run --group examples ./validate.sh <example-name>
```

## Code style and linting
Expand All @@ -140,17 +125,16 @@ Key rules:
Run formatting and lint fixes:

```bash
ruff check --fix
ruff format
uv run ruff check --fix && uv run ruff format
```

**Type checking**: MyPy

```bash
mypy --config-file mypy.ini
uv run mypy
```

MyPy is configured to check: `dapr/actor/`, `dapr/clients/`, `dapr/conf/`, `dapr/serializers/`, `ext/dapr-ext-grpc/`, `ext/dapr-ext-fastapi/`, `ext/flask_dapr/`, and `examples/demo_actor/`. Proto stubs (`dapr.proto.*`) have errors ignored.
MyPy is configured to check: `dapr/actor/`, `dapr/aio/`, `dapr/clients/`, `dapr/conf/`, `dapr/serializers/`, `ext/dapr-ext-grpc/`, `ext/dapr-ext-fastapi/`, `ext/flask_dapr/`, and `examples/demo_actor/`. Proto stubs (`dapr.proto.*`) have errors ignored. Configuration lives in `pyproject.toml` under `[tool.mypy]`.

## Commit and PR conventions

Expand Down Expand Up @@ -184,14 +168,14 @@ When completing any task on this project, work through this checklist. Not every

### Linting and type checking

- [ ] Run `ruff check --fix && ruff format` and fix any remaining issues
- [ ] Run `mypy --config-file mypy.ini` if you changed files covered by mypy (actor, clients, conf, serializers, ext-grpc, ext-fastapi, flask_dapr)
- [ ] Run `uv run ruff check --fix && uv run ruff format` and fix any remaining issues
- [ ] Run `uv run mypy` if you changed files covered by mypy (actor, aio, clients, conf, serializers, ext-grpc, ext-fastapi, flask_dapr)

### Examples (integration tests)

- [ ] If you added a new user-facing feature or building block, add or update an example in `examples/`
- [ ] Ensure the example README has `<!-- STEP -->` blocks with `expected_stdout_lines` so it is validated in CI
- [ ] If you added a new example, register it in `tox.ini` under `[testenv:examples]`
- [ ] If you added a new example, add it to the `validate_examples.yaml` CI workflow
- [ ] If you changed output format of existing functionality, update `expected_stdout_lines` in affected example READMEs
- [ ] See `examples/AGENTS.md` for full details on writing examples

Expand All @@ -202,23 +186,20 @@ When completing any task on this project, work through this checklist. Not every

### Final verification

- [ ] Run `tox -e ruff` — linting must be clean
- [ ] Run `tox -e py311` (or your Python version) — all unit tests must pass
- [ ] If you touched examples: `tox -e example-component -- <example-name>` to validate locally
- [ ] Run `uv run ruff check --fix && uv run ruff format` — linting must be clean
- [ ] Run `uv run python -m unittest discover -v ./tests` — all unit tests must pass
- [ ] If you touched examples: `cd examples && uv run --group examples ./validate.sh <example-name>` to validate locally
- [ ] Commits must be signed off for DCO: `git commit -s`

## Important files

| File | Purpose |
|------|---------|
| `setup.cfg` | Core package metadata and dependencies |
| `setup.py` | Package build script (handles dev version suffixing) |
| `pyproject.toml` | Ruff configuration |
| `tox.ini` | Test environments and CI commands |
| `mypy.ini` | Type checking configuration |
| `dev-requirements.txt` | Development/test dependencies |
| `dapr/version/__init__.py` | SDK version string |
| `ext/*/setup.cfg` | Extension package metadata and dependencies |
| `pyproject.toml` | Package metadata, dependencies, ruff, mypy, and uv workspace config |
| `uv.lock` | Locked dependency versions (reproducible installs) |
| `setup.py` | PyPI publish helper (handles dev version suffixing) |
| `ext/*/pyproject.toml` | Extension package metadata and dependencies |
| `dapr/version/version.py` | SDK version string |
| `examples/validate.sh` | Entry point for mechanical-markdown example validation |

## Gotchas
Expand All @@ -227,7 +208,7 @@ When completing any task on this project, work through this checklist. Not every
- **Proto files**: Never manually edit anything under `dapr/proto/`. These are generated.
- **Extension independence**: Each extension is a separate PyPI package. Core SDK changes should not break extensions; extension changes should not require core SDK changes unless intentional.
- **DCO signoff**: PRs will be blocked by the DCO bot if commits lack `Signed-off-by`. Always use `git commit -s`.
- **Ruff version pinned**: Dev requirements pin `ruff === 0.14.1`. Use this exact version to match CI.
- **Ruff version pinned**: `pyproject.toml` pins `ruff==0.14.1` in `[dependency-groups].dev`. Use `uv sync --all-packages --group dev` to get the exact version.
- **Examples are integration tests**: Changing output format (log messages, print statements) can break example validation. Always check `expected_stdout_lines` in example READMEs when modifying user-visible output.
- **Background processes in examples**: Examples that start background services (servers, subscribers) must include a cleanup step to stop them, or CI will hang.
- **Workflow is the most active area**: See `ext/dapr-ext-workflow/AGENTS.md` for workflow-specific architecture and constraints.
Loading
Loading