Skip to content

Commit 2dc31c1

Browse files
authored
Merge branch 'main' into feat/mcp-crd
2 parents 9dc3565 + a56c7b1 commit 2dc31c1

53 files changed

Lines changed: 2157 additions & 629 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build-push-to-main.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,7 @@ jobs:
5252
run: uv run mypy
5353
- name: Run unit-tests
5454
run: |
55-
uv run coverage run -m unittest discover -v ./tests
56-
for dir in ext/*/tests; do
57-
uv run coverage run -a -m unittest discover -v "./$dir"
58-
done
59-
uv run coverage run -a -m pytest -m "not e2e" ./ext/dapr-ext-workflow/tests/durabletask/
55+
uv run coverage run -m pytest tests ext -m "not e2e" --ignore=tests/integration --ignore=tests/examples --import-mode=importlib
6056
uv run coverage xml
6157
- name: Upload test coverage
6258
uses: codecov/codecov-action@v6

.github/workflows/build-tag.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,7 @@ jobs:
5252
run: uv run mypy
5353
- name: Run unit-tests
5454
run: |
55-
uv run coverage run -m unittest discover -v ./tests
56-
for dir in ext/*/tests; do
57-
uv run coverage run -a -m unittest discover -v "./$dir"
58-
done
59-
uv run coverage run -a -m pytest -m "not e2e" ./ext/dapr-ext-workflow/tests/durabletask/
55+
uv run coverage run -m pytest tests ext -m "not e2e" --ignore=tests/integration --ignore=tests/examples --import-mode=importlib
6056
uv run coverage xml
6157
- name: Upload test coverage
6258
uses: codecov/codecov-action@v6

.github/workflows/build.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,7 @@ jobs:
5858
run: uv run mypy
5959
- name: Run unit-tests
6060
run: |
61-
uv run coverage run -m unittest discover -v ./tests
62-
for dir in ext/*/tests; do
63-
uv run coverage run -a -m unittest discover -v "./$dir"
64-
done
65-
uv run coverage run -a -m pytest -m "not e2e" ./ext/dapr-ext-workflow/tests/durabletask/
61+
uv run coverage run -m pytest tests ext -m "not e2e" --ignore=tests/integration --ignore=tests/examples --import-mode=importlib
6662
uv run coverage xml
6763
- name: Upload test coverage
6864
uses: codecov/codecov-action@v6

.github/workflows/run-tests.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: validate-examples
1+
name: run-tests
22

33
on:
44
push:
@@ -86,7 +86,7 @@ jobs:
8686
- name: Install uv
8787
uses: astral-sh/setup-uv@v7
8888
- name: Install dependencies
89-
run: uv sync --frozen --all-packages --group examples
89+
run: uv sync --frozen --all-packages --group tests
9090
- name: Set up Dapr CLI
9191
uses: dapr/.github/.github/actions/setup-dapr-cli@main
9292
with:
@@ -103,9 +103,9 @@ jobs:
103103
nohup ollama serve &
104104
sleep 10
105105
ollama pull llama3.2:latest
106-
- name: Check examples
107-
run: |
108-
uv run pytest tests/examples/
109106
- name: Run integration tests
110107
run: |
111108
uv run pytest tests/integration/
109+
- name: Validate examples
110+
run: |
111+
uv run pytest tests/examples/

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,9 @@ coverage.lcov
136136

137137
# macOS specific files
138138
.DS_Store
139+
140+
# Integration test scratch dirs
141+
tests/integration/.binding-data/
142+
143+
# Crypto test material generated at test time (see tests/crypto_utils.py)
144+
tests/integration/keys/

CLAUDE.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
@AGENTS.md
22

3-
Use pathlib instead of os.path.
4-
Use httpx instead of urllib.
5-
subprocess(`shell=True`) is used only when it makes the code more readable. Use either shlex or args lists.
6-
subprocess calls should have a reasonable timeout.
7-
Use modern Python (3.10+) features.
83
Make all code strongly typed.
94
Keep conditional nesting to a minimum, and use guard clauses when possible.
10-
Aim for medium "visual complexity": use intermediate variables to store results of nested/complex function calls, but don't create a new variable for everything.
11-
Avoid comments unless there is a gotcha, a complex algorithm or anything an experienced code reviewer needs to be aware of. Focus on making better Google-style docstrings instead.
5+
Aim for medium visual complexity: use intermediate variables to store results of nested/complex function calls. A complex function call could be:
6+
- `f(Object(a=1, b=2, c=3))`, the inner object has more than 2 meaningful args
7+
- `f(Object((a, b)))`, 2 levels of nesting or anything with a long chain of closing parens
8+
- `small_transformation(ImportantObject())`, the object itself is the main subject of the function but the transformation steals the focus
9+
Use descriptive, self-documenting names for these intermediate variables.
10+
Closely related variable names should share a root and use different suffixes. For example, `request_original` and `request_clean`, but not `clean_request`.
11+
Avoid comments unless there is a gotcha, a complex algorithm or anything an experienced code reviewer needs to be aware of. Focus on making short but descriptive Google-style docstrings instead.
1212

13-
The user is not always right. Be skeptical and do not blindly comply if something doesn't make sense.
13+
Use modern Python (3.10+) features.
14+
Use pathlib instead of os.path.
15+
Use httpx instead of urllib.
16+
`subprocess(shell=True)` is used only when it makes the code more readable. Use either shlex or args lists.
17+
Anything that can have an explicit timeout should have one.
1418
Code should be cross-platform and production ready.
19+
20+
The user is not always right. Be skeptical and do not blindly comply if something doesn't make sense.

dapr/actor/runtime/config.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def __init__(
117117
self,
118118
actor_idle_timeout: Optional[timedelta] = timedelta(hours=1),
119119
actor_scan_interval: Optional[timedelta] = timedelta(seconds=30),
120-
drain_ongoing_call_timeout: Optional[timedelta] = timedelta(minutes=1),
120+
drain_ongoing_call_timeout: Optional[timedelta] = None,
121121
drain_rebalanced_actors: Optional[bool] = True,
122122
reentrancy: Optional[ActorReentrancyConfig] = None,
123123
reminders_storage_partitions: Optional[int] = None,
@@ -130,9 +130,13 @@ def __init__(
130130
actor_scan_interval (datetime.timedelta): The duration which specifies how often to scan
131131
for actors to deactivate idle actors. Actors that have been idle longer than
132132
actor_idle_timeout will be deactivated.
133-
drain_ongoing_call_timeout (datetime.timedelta): The duration which specifies the
134-
timeout for the current active actor method to finish before actor deactivation.
135-
If there is no current actor method call, this is ignored.
133+
drain_ongoing_call_timeout (Optional[datetime.timedelta]): The duration which
134+
specifies the timeout for the current active actor method to finish before
135+
actor deactivation. If there is no current actor method call, this is
136+
ignored. Defaults to None, which omits the field from the configuration
137+
sent to daprd so the runtime applies its own default. An explicit value
138+
must be shorter than the daprd placement dissemination timeout, otherwise
139+
daprd will clamp it.
136140
drain_rebalanced_actors (bool): If true, Dapr will wait for drain_ongoing_call_timeout
137141
to allow a current actor call to complete before trying to deactivate an actor.
138142
reentrancy (ActorReentrancyConfig): Configure the reentrancy behavior for an actor.
@@ -175,10 +179,12 @@ def as_dict(self) -> Dict[str, Any]:
175179
configDict: Dict[str, Any] = {
176180
'actorIdleTimeout': self._actor_idle_timeout,
177181
'actorScanInterval': self._actor_scan_interval,
178-
'drainOngoingCallTimeout': self._drain_ongoing_call_timeout,
179182
'drainRebalancedActors': self._drain_rebalanced_actors,
180183
}
181184

185+
if self._drain_ongoing_call_timeout is not None:
186+
configDict['drainOngoingCallTimeout'] = self._drain_ongoing_call_timeout
187+
182188
if self._reentrancy:
183189
configDict.update({'reentrancy': self._reentrancy.as_dict()})
184190

examples/pubsub-streaming-async/publisher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ async def publish_events():
4444
)
4545

4646
# Print the request
47-
print(req_data, flush=True)
47+
print(req_data)
4848

4949
await asyncio.sleep(1)
5050

examples/pubsub-streaming-async/subscriber.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def process_message(message):
1919
global counter
2020
counter += 1
2121
# Process the message here
22-
print(f'Processing message: {message.data()} from {message.topic()}...', flush=True)
22+
print(f'Processing message: {message.data()} from {message.topic()}...')
2323
return 'success'
2424

2525

pyproject.toml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,22 +66,25 @@ dev = [
6666
"types-grpcio-status~=1.0.0",
6767
"coverage~=7.13.4",
6868
"wheel~=0.46.3",
69-
"opentelemetry-sdk~=1.40.0",
69+
"opentelemetry-sdk>=1.40,<1.42",
7070
"opentelemetry-instrumentation-grpc~=0.61b0",
7171
"opentelemetry-exporter-zipkin~=1.11.1",
7272
"httpx~=0.28.1",
7373
"pyOpenSSL~=26.0.0",
74+
"cryptography>=42.0.0",
75+
"redis>=7.4.0",
7476
"Flask~=3.1.3",
7577
"pytest~=9.0.2",
78+
"pytest-asyncio>=0.23",
7679
"ruff==0.14.1",
7780
"python-dotenv~=1.2.2",
7881
"pydantic~=2.13.3",
7982
"PyYAML~=6.0.3",
8083
]
81-
examples = [
84+
tests = [
8285
{include-group = "dev"},
8386
"mechanical-markdown~=0.8.0",
84-
"langchain-ollama~=1.0.1",
87+
"langchain-ollama>=1.0.1,<1.2.0",
8588
]
8689

8790
[tool.ruff]
@@ -142,3 +145,4 @@ markers = [
142145
'example_dir(name): set the example directory for the dapr fixture',
143146
]
144147
pythonpath = ["."]
148+
asyncio_mode = "auto"

0 commit comments

Comments
 (0)