Skip to content

Commit 816c745

Browse files
committed
Address PR feedback (1)
Signed-off-by: Sergio Herrera <627709+seherv@users.noreply.github.com>
1 parent 4e02483 commit 816c745

20 files changed

Lines changed: 46 additions & 14 deletions

.github/workflows/build-tag.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ jobs:
9797
# overwriting an existing release; replacing a tagged version's
9898
# contents requires bumping VERSION and re-tagging.
9999
twine upload --skip-existing dist/*
100+
# TODO: remove in 1.20.
100101
# The previously-separate distributions (dapr-ext-fastapi, dapr-ext-grpc,
101102
# dapr-ext-langgraph, dapr-ext-strands, dapr-ext-workflow, flask-dapr)
102103
# are intentionally NOT republished. Bundling the extension code into

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ pip-delete-this-directory.txt
4545

4646
# Unit test / coverage reports
4747
htmlcov/
48-
.tox/
4948
.nox/
5049
.coverage
5150
.coverage.*

dapr/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
limitations under the License.
1414
"""
1515

16+
# TODO: remove in 1.20 (pre-1.19 dapr-ext-* / flask-dapr migration only).
17+
#
1618
# On import, checks for two states a legacy dapr-ext-* install could leave
1719
# the environment in.
1820
#

dapr/ext/fastapi/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
from .actor import DaprActor
1818
from .app import DaprApp
1919
except ImportError as exc:
20+
if exc.name != 'fastapi':
21+
raise
2022
raise ImportError(
2123
f'dapr.ext.fastapi is missing an optional dependency ({exc.name!r}). '
2224
f'Install the extension with: pip install "dapr[fastapi]"'

dapr/ext/fastapi/actor.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@
1515

1616
from typing import Any, List, Optional, Type
1717

18-
from dapr.actor import Actor, ActorRuntime
19-
from dapr.clients.exceptions import ERROR_CODE_UNKNOWN, DaprInternalError
20-
from dapr.serializers import DefaultJSONSerializer
2118
from fastapi import APIRouter, FastAPI, Request, Response, status # type: ignore
2219
from fastapi.logger import logger
2320
from fastapi.responses import JSONResponse
2421

22+
from dapr.actor import Actor, ActorRuntime
23+
from dapr.clients.exceptions import ERROR_CODE_UNKNOWN, DaprInternalError
24+
from dapr.serializers import DefaultJSONSerializer
25+
2526
DEFAULT_CONTENT_TYPE = 'application/json; utf-8'
2627
DAPR_REENTRANCY_ID_HEADER = 'Dapr-Reentrancy-Id'
2728

dapr/ext/flask/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
from .actor import DaprActor
1818
from .app import DaprApp
1919
except ImportError as exc:
20+
if exc.name != 'flask':
21+
raise
2022
raise ImportError(
2123
f'dapr.ext.flask is missing an optional dependency ({exc.name!r}). '
2224
f'Install the extension with: pip install "dapr[flask]"'

dapr/ext/flask/actor.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616
import asyncio
1717
from typing import Any, Optional, Type
1818

19+
from flask import jsonify, make_response, request
20+
1921
from dapr.actor import Actor, ActorRuntime
2022
from dapr.clients.exceptions import ERROR_CODE_UNKNOWN, DaprInternalError
2123
from dapr.serializers import DefaultJSONSerializer
22-
from flask import jsonify, make_response, request
2324

2425
DEFAULT_CONTENT_TYPE = 'application/json; utf-8'
2526
DAPR_REENTRANCY_ID_HEADER = 'Dapr-Reentrancy-Id'

dapr/ext/grpc/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
try:
2121
from dapr.ext.grpc.app import App, Rule # type:ignore
2222
except ImportError as exc:
23+
if exc.name != 'cloudevents':
24+
raise
2325
raise ImportError(
2426
f'dapr.ext.grpc is missing an optional dependency ({exc.name!r}). '
2527
f'Install the extension with: pip install "dapr[grpc]"'

dapr/ext/grpc/_health_servicer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from typing import Callable, Optional
22

33
import grpc
4+
45
from dapr.proto import appcallback_service_v1
56
from dapr.proto.runtime.v1.appcallback_pb2 import HealthCheckResponse
67

dapr/ext/grpc/_servicer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
import warnings
1717
from typing import Callable, Dict, List, Optional, Tuple, Union
1818

19+
import grpc
1920
from cloudevents.sdk.event import v1 # type: ignore
2021
from google.protobuf import empty_pb2
2122
from google.protobuf.message import Message as GrpcMessage
2223
from google.protobuf.struct_pb2 import Struct
2324

24-
import grpc
2525
from dapr.clients._constants import DEFAULT_JSON_CONTENT_TYPE
2626
from dapr.clients.grpc._request import BindingRequest, InvokeMethodRequest, JobEvent
2727
from dapr.clients.grpc._response import InvokeMethodResponse, TopicEventResponse

0 commit comments

Comments
 (0)